linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Lenny Szubowicz <lszubowi@redhat.com>,
	rjw@rjwysocki.net, 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: Mon, 06 May 2019 16:46:15 -0700	[thread overview]
Message-ID: <a988c4cf340e9ae91d942bce02218de6e9c9815c.camel@linux.intel.com> (raw)
In-Reply-To: <20190502200052.26754-1-lszubowi@redhat.com>

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 <lszubowi@redhat.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  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);
>  }

  parent reply	other threads:[~2019-05-06 23:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02 20:00 ACPI / LPIT: Correct LPIT end address for lpit_process() Lenny Szubowicz
2019-05-02 20:00 ` Lenny Szubowicz
2019-05-06 23:46 ` Srinivas Pandruvada [this message]
2019-05-06 23:46   ` Srinivas Pandruvada
2019-05-31  9:25   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a988c4cf340e9ae91d942bce02218de6e9c9815c.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lszubowi@redhat.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).