]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
riscv: Fix relocation_hashtable size
authorCharlie Jenkins <charlie@rivosinc.com>
Thu, 4 Jan 2024 19:42:49 +0000 (11:42 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Feb 2024 00:20:57 +0000 (16:20 -0800)
[ Upstream commit a35551c7244d9d061643a01eb96cc3ba04eaf45c ]

A second dereference is needed to get the accurate size of the
relocation_hashtable.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Fixes: d8792a5734b0 ("riscv: Safely remove entries from relocation list")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Closes: https://lore.kernel.org/r/202312120044.wTI1Uyaa-lkp@intel.com/
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20240104-module_loading_fix-v3-3-a71f8de6ce0f@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/kernel/module.c

index 91f7cd221afcccc74743b91a9a5c66117857d3c2..c9d59a5448b6cf665f873b3d6b39100671d74d2c 100644 (file)
@@ -764,7 +764,7 @@ initialize_relocation_hashtable(unsigned int num_relocations,
        hashtable_size <<= should_double_size;
 
        *relocation_hashtable = kmalloc_array(hashtable_size,
-                                             sizeof(*relocation_hashtable),
+                                             sizeof(**relocation_hashtable),
                                              GFP_KERNEL);
        if (!*relocation_hashtable)
                return 0;