Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7614438yba; Thu, 2 May 2019 13:02:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMiFH0jHsTensDP66ANJ6TvoPzwhtHZYXapdcnOUkgy2MRFdsuy/eBnda+ze8ZGsSUYDG1 X-Received: by 2002:a62:b602:: with SMTP id j2mr6220103pff.68.1556827320265; Thu, 02 May 2019 13:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556827320; cv=none; d=google.com; s=arc-20160816; b=wSJ+PypiJZpQXE8+/93udJSdcr2Ff23bYOujBWGcQK+bDBhVm2hG75wMkLf/Uah72f 8+de6Ov7kIOaheuTYsFAbeEfLgMRy7C0RYC4HXluI/qiCaVdQfEROZsj0WSPhZ3Yy7jS UOfXmIJNwqnzlP3LCz9349Aka2M8CmhXl5vdXWNn65uEUPt3tg1IvL7EZTn2Lhk67HtK MQPb8cysNhfIkCHOnwvFTCfpl0J0epSvN1NkbUWskt+aiOrDs7MSsLnILXWhTTDc+w5G RhYGkx9UYpP8vPZDscwaMjnLjkc4TDYloV22AoDOM+0ZgLiClMUbOJfEdwOD12EJGidS 6o8g== 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:to:from; bh=+Tizv2+1Y1zNrdo/rvGz0ZevdEGTvfw52jSvPNzNfto=; b=w9nR24NYgDuCcqTiXoBHVLw2XfJ/15Blc+atL4sNnDzrAMHxxehEgCVC2fSzfjkLi/ ZmnfIS52J578fdjrAXLsyNjiGlB2f/ycL+4POTZUdIPZn0B9ApcAfJ+BtvVZ/75QFlc2 tDe5pGRALrhOZDMkYpS7dgMZIDnY8sCpI6KUXQcd/+Jcc4/YVqKKt5wr1RRau8DJHYa8 iMmpBNG8lhDGsf6G5UNfuIz0c5Wi0lNFJJnUZBSTxXNDfgWNX/dNYCr99ntupKLn8LKF cjHHC7F/lGtnT4s6l0LGGY5c9nNlr4haMqxCeiVP6mjgPCY08YZcg6a5XuyR0ToZaf7i XSQA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x188si27233143pfx.76.2019.05.02.13.01.44; Thu, 02 May 2019 13:02:00 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726164AbfEBUAy (ORCPT + 99 others); Thu, 2 May 2019 16:00:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36290 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbfEBUAx (ORCPT ); Thu, 2 May 2019 16:00:53 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8047A308620E; Thu, 2 May 2019 20:00:53 +0000 (UTC) Received: from lszubowi.bos.redhat.com (dhcp-17-123.bos.redhat.com [10.18.17.123]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA89A4274; Thu, 2 May 2019 20:00:52 +0000 (UTC) From: Lenny Szubowicz To: rjw@rjwysocki.net, lenb@kernel.org, srinivas.pandruvada@linux.intel.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: ACPI / LPIT: Correct LPIT end address for lpit_process() Date: Thu, 2 May 2019 16:00:52 -0400 Message-Id: <20190502200052.26754-1-lszubowi@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 02 May 2019 20:00:53 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); } -- 2.18.1