Re: [PATCH] gpio: avoid undersized array bitmap in get fastpath

From: Bartosz Golaszewski

Date: Mon Nov 23 2026 - 10:20:27 EST


On Mon, Nov 23, 2026 at 11:51:57AM +0100, Linus Walleij wrote:
> Hi Kim,
>
> On Sun, Nov 22, 2026 at 5:38 AM <pocj8ur4in@xxxxxxxxx> wrote:
>
> > The array get fast path passes the caller's value bitmap directly to
> > get_multiple(). The bitmap is sized for the requested array, but
> > providers such as gpio-sim process it for the entire chip. With a
> > 128-line chip and a one-line array on a 64-bit kernel, gpio-sim's
> > bitmap_replace() reads and writes two words when the caller has
> > allocated only one. The second word is accessed even though its mask
> > is zero.
>
> Isn't that a problem with gpio-sim that should be fixed there?
>

I'm fine sanitizing driver input at the GPIOLIB level but this patch
doesn't apply to linux-next.

Bart