From patchwork Fri Oct 12 19:29:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 148797 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1097986lji; Fri, 12 Oct 2018 12:29:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV61dJ2GhdsQgeXSPugv8nZQwIKXJn6LfYsdM4X9EP0CNLya13cG+SoZSmiFa089KJkhpvzNi X-Received: by 2002:a62:c40f:: with SMTP id y15-v6mr7330808pff.161.1539372582590; Fri, 12 Oct 2018 12:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539372582; cv=none; d=google.com; s=arc-20160816; b=RJo5fDCWiXCMnrzG2/rDrpBYRA2GRRcJtjznBMVUzbVAwGDwwOxv0d1bL8VAB+EHDX bs0gXp1kJ6+DfuZR8LWVb2xEma3Lg/T6u9ueiFazzNLS8dRH/jGvzvclurfuKl1sDZXG lGbmrRp2UGr6wh2+IRmzz/6ZnIocCYYySer346OB1Bv3BCaJUF1rDHwoSmGozXOiM7fQ 5v4jhgJhfzNUqhTmBzNGPXae66S/krR4J143AYodpSBchAJJSJtb4S+cCvXdAyeq7oT7 SizwHQjK0Jp7ustO2ZN+Qg7NvY+H98/s1f9IbUgitcdsw+xZbi5Nh/z1Llvr4AZD4VsA PKUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=fvKYRpSOwLQ6WtksrlFxrbpUv0tcxFzftxgyis0smfQ=; b=hpz0Ne21Jr4qvwDv66c91rDx/cVK4jItDPTLWQOFbOvFOeycVNpvowJdVmZ/NMNoB5 qrmTgZvg1QMBkgORCwO0b+iq7ZvYbS23Mn1D4QcHzegZu0JEaNLCU7et4SyiTSW83Fiw 1y3Qu/iMfQon007tQCE61s45nQ1X4oJa0W96lQQzI/J2YEnZ1KFZBfjoQdR5RyFqNOAL DBUT4LNPQ6sQBVm3p+vEpq1rqvQ7umIR2YP3mlmmT6SN4f22h1xLZa0rNOydMeQ7fpTw 96nlQws1UqaR4nFPtx+hndfQ5CQtiBiRNB1/FnTmu7YOUsj3pdXHShBYijcQel9mY9hQ 2dfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y125-v6si2006435pgb.14.2018.10.12.12.29.41; Fri, 12 Oct 2018 12:29:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726072AbeJMDDk (ORCPT + 9 others); Fri, 12 Oct 2018 23:03:40 -0400 Received: from foss.arm.com ([217.140.101.70]:56622 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725935AbeJMDDk (ORCPT ); Fri, 12 Oct 2018 23:03:40 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D14B2F; Fri, 12 Oct 2018 12:29:40 -0700 (PDT) Received: from beelzebub.austin.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 358C83F5BC; Fri, 12 Oct 2018 12:29:40 -0700 (PDT) From: Jeremy Linton To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will.deacon@arm.com, ard.biesheuvel@linaro.org, james.morse@arm.com, rafael.j.wysocki@intel.com, takahiro.akashi@linaro.org, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, ahs3@redhat.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Jeremy Linton Subject: [PATCH 2/2] arm64: acpi: Prepare for longer MADTs Date: Fri, 12 Oct 2018 14:29:37 -0500 Message-Id: <20181012192937.3819951-1-jeremy.linton@arm.com> X-Mailer: git-send-email 2.14.3 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The BAD_MADT_GICC_ENTRY check is a little too strict because it rejects MADT entries that don't match the currently known lengths. We should remove this restriction to avoid problems if the table length changes. Future code which might depend on additional fields should be written to validate those fields before using them, rather than trying to globally check known MADT version lengths. Signed-off-by: Jeremy Linton --- arch/arm64/include/asm/acpi.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.14.3 Acked-by: Sudeep Holla diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 709208dfdc8b..4d0946bd485a 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -22,12 +22,12 @@ #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 ACPI_MADT_GICC_MIN_LENGTH ACPI_OFFSET( \ + struct acpi_madt_generic_interrupt, efficiency_class) #define BAD_MADT_GICC_ENTRY(entry, end) \ - (!(entry) || (entry)->header.length != ACPI_MADT_GICC_LENGTH || \ - (unsigned long)(entry) + ACPI_MADT_GICC_LENGTH > (end)) + (!(entry) || (entry)->header.length < ACPI_MADT_GICC_MIN_LENGTH || \ + (unsigned long)(entry) + (entry)->header.length > (end)) /* Basic configuration for ACPI */ #ifdef CONFIG_ACPI