public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Mika Westerberg <westeri@kernel.org>,
	linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>
Subject: Re: [PATCH v2 1/1] gpiolib: acpi: Fix potential out-of-boundary left shift
Date: Tue, 27 Jan 2026 15:49:51 +0200	[thread overview]
Message-ID: <aXjCfwnnASFZ1Ghh@smile.fi.intel.com> (raw)
In-Reply-To: <20260127134300.GK2275908@black.igk.intel.com>

On Tue, Jan 27, 2026 at 02:43:00PM +0100, Mika Westerberg wrote:
> On Tue, Jan 27, 2026 at 12:06:30PM +0100, Andy Shevchenko wrote:
> > GPIO Address Space handler gets a pointer to the in or out value.
> > This value is supposed to be at least 64-bit, but it's not limited
> > to be exactly 64-bit. When ACPI tables are being parsed, for
> > the bigger Connection():s ACPICA creates a Buffer instead of regular
> > Integer object. The Buffer exists as long as Namespace holds
> > the certain Connection(). Hence we can access the necessary bits
> > without worrying. On the other hand, the left shift, used in
> > the code, is limited by 31 (on 32-bit platforms) and otherwise
> > considered to be Undefined Behaviour. Also the code uses only
> > the first 64-bit word for the value, and anything bigger than 63
> > will be also subject to UB. Fix all this by modifying the code
> > to correctly set or clear the respective bit in the bitmap constructed
> > of 64-bit words.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Perfect, thanks!

> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Thank you!

Bart, since you picked up the patch in the same lines of code, feel free to
take this one on top (I think it's your gpio/for-current branch).

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-01-27 13:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 11:06 [PATCH v2 1/1] gpiolib: acpi: Fix potential out-of-boundary left shift Andy Shevchenko
2026-01-27 13:43 ` Mika Westerberg
2026-01-27 13:49   ` Andy Shevchenko [this message]
2026-01-28  9:02     ` Bartosz Golaszewski
2026-01-28  9:10       ` Andy Shevchenko
2026-01-28  9:00 ` Bartosz Golaszewski

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=aXjCfwnnASFZ1Ghh@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=westeri@kernel.org \
    /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