Re: [PATCH v2] gpio: avoid undersized array bitmap in get fastpath
From: Linus Walleij
Date: Tue Dec 01 2026 - 15:44:58 EST
On Mon, Nov 30, 2026 at 1:28 AM Baek Kyu, Kim <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.
>
> Use the existing per-chip path when the chip needs more bitmap words
> than the caller provides. That path uses a chip-sized temporary bitmap
> and copies only the requested values back.
>
> Fixes: b17566a6b08b ("gpiolib: Implement fast processing path in get/set array")
> Signed-off-by: Baek Kyu, Kim <pocj8ur4in@xxxxxxxxx>
All right then!
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Yours,
Linus Walleij