Re: [PATCH] sh: sq: Fix incorrect element size for allocating bitmap buffer

From: Geert Uytterhoeven
Date: Wed Apr 19 2023 - 07:59:38 EST


On Wed, Apr 19, 2023 at 1:55 PM John Paul Adrian Glaubitz
<glaubitz@xxxxxxxxxxxxxxxxxxx> wrote:
> The Store Queue code allocates a bitmap buffer with the size of
> multiple of sizeof(long) in sq_api_init(). While the buffer size
> is calculated correctly, the code uses the wrong element size to
> allocate the buffer which results in the allocated bitmap buffer
> being too small.
>
> Fix this by allocating the buffer with kcalloc() with element size
> sizeof(long) instead of kzalloc() whose elements size defaults to
> sizeof(char).
>
> Fixes: d7c30c682a27 ("sh: Store Queue API rework.")
> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds