From patchwork Mon Jul 6 23:16:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 50800 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 423A4229FC for ; Mon, 6 Jul 2015 23:17:04 +0000 (UTC) Received: by wifm2 with SMTP id m2sf15092420wif.1 for ; Mon, 06 Jul 2015 16:17:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=DKrFu7FGJi+UuS0COapLLOm9xvb+DlZ/tp/F9N9omY0=; b=Q2rGOgVQ7Im7i83Xd6cxF4YNoJoXz88mWx1fLjo3XR4mHmW4T39IQP7yk8/SYbZYKX sAhdOcNdfhBTAJ0A+VsQbpaM+qZk5Ke31klOw7/W7n412FZ4HnCU7lqu/QDfPp7NBVwK ye4G6t409YjmzdaP8KHTlg4qVXNspEoFmYrESwOP9mbkOTtl0hVw0B7s0v1nb13Do8Mj y151KkI+TgCK2O4u5mfeRiNGO89woz41fFc7N05WSDkNVaaVVF7dw4Vk61tCT/z+aFqs vKfxEgHRS/cN866NVmPPYJeKtzqMZ7csIonGUPgksigQMfdb+Aed0ucJebN9Adq/iBdU WnUg== X-Gm-Message-State: ALoCoQnFTlL3SIxV1o2tnUgTZv73Uum1p2Of/YTqPJWa2u7l2XBbFux/2U7bsvNhNxySYntBrt4y X-Received: by 10.180.216.12 with SMTP id om12mr16449635wic.1.1436224623618; Mon, 06 Jul 2015 16:17:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.228 with SMTP id z4ls769913lal.90.gmail; Mon, 06 Jul 2015 16:17:03 -0700 (PDT) X-Received: by 10.152.9.137 with SMTP id z9mr1223197laa.68.1436224623456; Mon, 06 Jul 2015 16:17:03 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id yr2si16497595lbb.117.2015.07.06.16.17.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 16:17:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by labgy5 with SMTP id gy5so21575107lab.2 for ; Mon, 06 Jul 2015 16:17:03 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr1241019lbb.56.1436224622901; Mon, 06 Jul 2015 16:17:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2013984lbb; Mon, 6 Jul 2015 16:17:02 -0700 (PDT) X-Received: by 10.107.152.146 with SMTP id a140mr1865459ioe.72.1436224621465; Mon, 06 Jul 2015 16:17:01 -0700 (PDT) Received: from mail-ie0-f176.google.com (mail-ie0-f176.google.com. [209.85.223.176]) by mx.google.com with ESMTPS id rt10si14245796igb.38.2015.07.06.16.17.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 16:17:01 -0700 (PDT) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 209.85.223.176 as permitted sender) client-ip=209.85.223.176; Received: by ieqy10 with SMTP id y10so123902285ieq.0 for ; Mon, 06 Jul 2015 16:17:00 -0700 (PDT) X-Received: by 10.50.102.68 with SMTP id fm4mr45612278igb.25.1436224620683; Mon, 06 Jul 2015 16:17:00 -0700 (PDT) Received: from fidelio.ahs3.com (c-50-134-239-249.hsd1.co.comcast.net. [50.134.239.249]) by mx.google.com with ESMTPSA id y98sm5531581ioi.25.2015.07.06.16.16.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 16:16:59 -0700 (PDT) From: Al Stone To: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: rjw@rjwysocki.net, lenb@kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, tglx@linutronix.de, jason@lakedaemon.net, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, linaro-kernel@lists.linaro.org, patches@linaro.org Subject: [PATCH v4 1/2] ACPI / ARM64: add BAD_MADT_GICC_ENTRY() macro Date: Mon, 6 Jul 2015 17:16:47 -0600 Message-Id: <1436224608-27754-2-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1436224608-27754-1-git-send-email-al.stone@linaro.org> References: <1436224608-27754-1-git-send-email-al.stone@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: al.stone@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Al Stone The BAD_MADT_ENTRY() macro is designed to work for all of the subtables of the MADT. In the ACPI 5.1 version of the spec, the struct for the GICC subtable (struct acpi_madt_generic_interrupt) is 76 bytes long; in ACPI 6.0, the struct is 80 bytes long. But, there is only one definition in ACPICA for this struct -- and that is the 6.0 version. Hence, when BAD_MADT_ENTRY() compares the struct size to the length in the GICC subtable, it fails if 5.1 structs are in use, and there are systems in the wild that have them. This patch adds the BAD_MADT_GICC_ENTRY() that checks the GICC subtable only, accounting for the difference in specification versions that are possible. The BAD_MADT_ENTRY() will continue to work as is for all other MADT subtables. This code is being added to an arm64 header file since that is currently the only architecture using the GICC subtable of the MADT. As a GIC is specific to ARM, it is also unlikely the subtable will be used elsewhere. Fixes: aeb823bbacc2 (ACPICA: ACPI 6.0: Add changes for FADT table.) Signed-off-by: Al Stone --- arch/arm64/include/asm/acpi.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 39248d3..c650c91 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -19,6 +19,14 @@ #include #include +/* Macros for consistency checks of the GICC subtable of MADT */ +#define ACPI_MADT_GICC_LENGTH \ + (acpi_gbl_FADT.header.revision < 6 ? 76 : 80) + +#define BAD_MADT_GICC_ENTRY(entry, end) ( \ + (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ + entry->header.length != ACPI_MADT_GICC_LENGTH) + /* Basic configuration for ACPI */ #ifdef CONFIG_ACPI /* ACPI table mapping after acpi_gbl_permanent_mmap is set */