From patchwork Thu Jun 18 22:36:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 50059 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0EE13228CC for ; Thu, 18 Jun 2015 22:36:27 +0000 (UTC) Received: by laar3 with SMTP id r3sf12278419laa.1 for ; Thu, 18 Jun 2015 15:36:25 -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=urjdmAsIOGaPha85S1fXvZBc5ng6yQbnmZQG0Gf1cWE=; b=K2D69sKDkZGT8rsy/gc5p5I6qh0ZYZGfqCIuN1cGJLkAsYsXHKjC3UrXYPEEJhR5C6 kE0KIDKPFIgCeFopuwid4ERG8IwtcHoiED9Kzd7j4sgJgbGaEleKnX9gPVzbjYOXDjOm ZuiVFZt74kecioJ4NRxJxx5HzAQ/REqCvnL3NYxtfC5ZnGA1U5j9IZKdo+dQg8+S0yWN X69LoW3tHzjC1FLrJTabOChaRTG4hTQeK8Ec5aiWRgGgQrHFu1KkLrnpKfzqXmizH8Tq fiIY7wRugbSDLSQwd++qVyq2ChWblMAhLSNbbLqguIwY4JicQAIDJksswkcUeiwLAeYK c98g== X-Gm-Message-State: ALoCoQkda6Yxs/AsVtstBXklcyQD6Vs5wz+5esWBGripJpOlWy+k3LB5sCb9oppseye6x8rvXNFr X-Received: by 10.194.47.179 with SMTP id e19mr9589685wjn.4.1434666985902; Thu, 18 Jun 2015 15:36:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.136 with SMTP id q8ls593354laj.91.gmail; Thu, 18 Jun 2015 15:36:25 -0700 (PDT) X-Received: by 10.152.6.105 with SMTP id z9mr14585555laz.98.1434666985742; Thu, 18 Jun 2015 15:36:25 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id r1si7463372lar.2.2015.06.18.15.36.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 15:36:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbvz5 with SMTP id vz5so13106655lbb.0 for ; Thu, 18 Jun 2015 15:36:25 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr15210650lbb.56.1434666985609; Thu, 18 Jun 2015 15:36:25 -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 hn6csp148433lbb; Thu, 18 Jun 2015 15:36:24 -0700 (PDT) X-Received: by 10.50.97.33 with SMTP id dx1mr478308igb.1.1434666984169; Thu, 18 Jun 2015 15:36:24 -0700 (PDT) Received: from mail-ie0-f170.google.com (mail-ie0-f170.google.com. [209.85.223.170]) by mx.google.com with ESMTPS id f16si536983igo.41.2015.06.18.15.36.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 15:36:24 -0700 (PDT) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 209.85.223.170 as permitted sender) client-ip=209.85.223.170; Received: by iebmu5 with SMTP id mu5so64260667ieb.1 for ; Thu, 18 Jun 2015 15:36:23 -0700 (PDT) X-Received: by 10.43.10.194 with SMTP id pb2mr8644481icb.31.1434666983435; Thu, 18 Jun 2015 15:36:23 -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 f82sm5828300ioj.37.2015.06.18.15.36.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 15:36:22 -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 v2 2/3] ACPI: add BAD_MADT_GICC_ENTRY() macro Date: Thu, 18 Jun 2015 16:36:07 -0600 Message-Id: <1434666968-1543-3-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1434666968-1543-1-git-send-email-al.stone@linaro.org> References: <1434666968-1543-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.217.169 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: , 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. Signed-off-by: Al Stone Reviewed-by: Hanjun Guo --- include/linux/acpi.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 33ed313..d3a1758 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -127,6 +127,16 @@ static inline void acpi_initrd_override(void *data, size_t size) (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) +#define ACPI_MADT_GICC_51_LENGTH 76 +#define ACPI_MADT_GICC_60_LENGTH 80 + +#define BAD_MADT_GICC_ENTRY(entry, end) ( \ + (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ + ((ACPI_FADT_SPEC_VERSION == ACPI_SPEC_VERSION(5, 1)) && \ + (entry->header.length != ACPI_MADT_GICC_51_LENGTH)) || \ + ((ACPI_FADT_SPEC_VERSION == ACPI_SPEC_VERSION(6, 0)) && \ + (entry->header.length != ACPI_MADT_GICC_60_LENGTH))) + char * __acpi_map_table (unsigned long phys_addr, unsigned long size); void __acpi_unmap_table(char *map, unsigned long size); int early_acpi_boot_init(void);