]> git.baikalelectronics.ru Git - kernel.git/commit
sh: sq: Fix incorrect element size for allocating bitmap buffer
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Wed, 19 Apr 2023 11:48:52 +0000 (13:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:49 +0000 (11:35 +0200)
commit7d3f3d790c6ba01749f2953744559b504023a8e6
tree73f66d763b826eef505073a149c6265558f6b5ad
parenta090146ce8a461592685b62511243b00fa284d16
sh: sq: Fix incorrect element size for allocating bitmap buffer

[ Upstream commit 80f746e2bd0e1da3fdb49a53570e54a1a225faac ]

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: f3b8392e43aa ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/sh/kernel/cpu/sh4/sq.c