summaryrefslogtreecommitdiff
path: root/arch/sh
diff options
context:
space:
mode:
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2023-04-19 14:48:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-17 12:47:58 +0300
commit95d97e182dbd4d75c44c41ae23f35d99df814acc (patch)
tree0ac30a96c8c9c7c8eaccc6d1992756f35860779a /arch/sh
parenta69eb1200eb699fb8c07f2b42285dfa291af071b (diff)
downloadlinux-95d97e182dbd4d75c44c41ae23f35d99df814acc.tar.xz
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: d7c30c682a27 ("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>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/cpu/sh4/sq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index d432164b23b7..c31ec0fea300 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -381,7 +381,7 @@ static int __init sq_api_init(void)
if (unlikely(!sq_cache))
return ret;
- sq_bitmap = kzalloc(size, GFP_KERNEL);
+ sq_bitmap = kcalloc(size, sizeof(long), GFP_KERNEL);
if (unlikely(!sq_bitmap))
goto out;