Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp348794ybi; Fri, 31 May 2019 02:26:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfU58yAY2DN/AACdUaypu65GDZikdcborN5DsD0rk+0ds6kp/LXotpw0+cJLx4lKIRvkna X-Received: by 2002:a17:90a:1b4f:: with SMTP id q73mr7852900pjq.75.1559294815381; Fri, 31 May 2019 02:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559294815; cv=none; d=google.com; s=arc-20160816; b=JSttlOeVGkzxp30eh2/TX1x6FLX7T+9jIP55F86Xly1HJFbXpKJI9xbvkjnHimb41w HzDm0A1e4VTAUe9IGrjPGiH1hC/9CTbXggPQqYrShmFUy2yoKyMs4EP6vbzYkITBJE4Y bsx+PFoFo8xrTEtU5YoNEH4dlIjWqZajX+2264+rYoIJu8DRPSCFWDIgGphZ5WjGQ8xW 6CWNadTh6h9WAbG0q3Sz6kz7wzqpooQUuCAooJ1vnceZ0UdLQCPzFRdLAyDQ7J/kvsn5 ip0jq+zz5ZWL+y6XzRsuaN7Oct1t6dwF93ULkNBVh2OSbCmzdsajZOa6gk1UKIrdvEdn m4xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NDgVZHr7WyeWron2348NErqzPAzqpa2pSCvkJM31CjA=; b=DfULgCTCCBWRS9vzDpS+N/3q66vO8+VJAsuSkTINQzU6MATg8TNFac0Hm4EAyv0JBY mfZH3M8kpd03HIMDbpc/LADmxMCM92Eulc2eSMqG9rZ6x4WMoYhxmP5dfBc0hCnLpvmv IsVrRGLNwLLK80HAcJ5tHcTkrGkO0hIfPinnFQ706GZ8z90kK83kLjKqMemwN0z7xclt j/jXAw04PNt0o54XS3APG4FmlF5LXxqDm37X7r2qToKX1XghcE1Etdw5qB/KW09E+wzT o4Yd8vvaQ+vD30wU4Wv6Bm9L70PlAJ3H766nqWE+D5+m5Be0wkk7m0q6dUMigfXqLBWp 0tdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 o4si5137205pgp.476.2019.05.31.02.26.38; Fri, 31 May 2019 02:26:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbfEaJZV (ORCPT + 99 others); Fri, 31 May 2019 05:25:21 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:47667 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726240AbfEaJZV (ORCPT ); Fri, 31 May 2019 05:25:21 -0400 Received: from 79.184.255.225.ipv4.supernova.orange.pl (79.184.255.225) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.213) id 91eb984658eeb43f; Fri, 31 May 2019 11:25:19 +0200 From: "Rafael J. Wysocki" To: Srinivas Pandruvada , Lenny Szubowicz Cc: lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: ACPI / LPIT: Correct LPIT end address for lpit_process() Date: Fri, 31 May 2019 11:25:18 +0200 Message-ID: <5685193.jDmapNlNO2@kreacher> In-Reply-To: References: <20190502200052.26754-1-lszubowi@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, May 7, 2019 1:46:15 AM CEST Srinivas Pandruvada wrote: > On Thu, 2019-05-02 at 16:00 -0400, Lenny Szubowicz wrote: > > Correct the LPIT end address which is passed into lpit_process() > > and the end address limit test in lpit_process(). > > > > The LPI state descriptor subtables follow the fixed sized > > acpi_lpit_header up to the end of the LPIT. The last LPI state > > descriptor can end at exactly the end of the LPIT. > > > > Note that this is a fix to a latent problem. Although incorrect, > > the unpatched version works because the passed in end address > > is just slightly beyond the actual end of the LPIT and the size > > of the ACPI LPIT header is smaller than the size of the only > > currently defined LPI state descriptor, acpi_lpit_native. > > > > Signed-off-by: Lenny Szubowicz > Reviewed-by: Srinivas Pandruvada > > > --- > > drivers/acpi/acpi_lpit.c | 7 +++---- > > 1 file changed, 3 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c > > index e43cb71b6972..8b170a07908a 100644 > > --- a/drivers/acpi/acpi_lpit.c > > +++ b/drivers/acpi/acpi_lpit.c > > @@ -137,7 +137,7 @@ static void lpit_update_residency(struct > > lpit_residency_info *info, > > > > static void lpit_process(u64 begin, u64 end) > > { > > - while (begin + sizeof(struct acpi_lpit_native) < end) { > > + while (begin + sizeof(struct acpi_lpit_native) <= end) { > > struct acpi_lpit_native *lpit_native = (struct > > acpi_lpit_native *)begin; > > > > if (!lpit_native->header.type && !lpit_native- > > >header.flags) { > > @@ -156,7 +156,6 @@ static void lpit_process(u64 begin, u64 end) > > void acpi_init_lpit(void) > > { > > acpi_status status; > > - u64 lpit_begin; > > struct acpi_table_lpit *lpit; > > > > status = acpi_get_table(ACPI_SIG_LPIT, 0, (struct > > acpi_table_header **)&lpit); > > @@ -164,6 +163,6 @@ void acpi_init_lpit(void) > > if (ACPI_FAILURE(status)) > > return; > > > > - lpit_begin = (u64)lpit + sizeof(*lpit); > > - lpit_process(lpit_begin, lpit_begin + lpit->header.length); > > + lpit_process((u64)lpit + sizeof(*lpit), > > + (u64)lpit + lpit->header.length); > > } > > Patch applied, thanks!