Skip to content

Commit 80f746e

Browse files
committed
sh: sq: Fix incorrect element size for allocating bitmap buffer
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: d7c30c6 ("sh: Store Queue API rework.") Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Link: https://lore.kernel.org/r/20230419114854.528677-1-glaubitz@physik.fu-berlin.de
1 parent 63f148c commit 80f746e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • arch/sh/kernel/cpu/sh4

arch/sh/kernel/cpu/sh4/sq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ static int __init sq_api_init(void)
382382
if (unlikely(!sq_cache))
383383
return ret;
384384

385-
sq_bitmap = kzalloc(size, GFP_KERNEL);
385+
sq_bitmap = kcalloc(size, sizeof(long), GFP_KERNEL);
386386
if (unlikely(!sq_bitmap))
387387
goto out;
388388

0 commit comments

Comments
 (0)