From: Charlie Jenkins Date: Thu, 4 Jan 2024 19:42:49 +0000 (-0800) Subject: riscv: Fix relocation_hashtable size X-Git-Tag: v6.7.3~289 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a5b2ca3f643c6e8655efc9043cb65cbdc697d53;p=thirdparty%2Fkernel%2Fstable.git riscv: Fix relocation_hashtable size [ Upstream commit a35551c7244d9d061643a01eb96cc3ba04eaf45c ] A second dereference is needed to get the accurate size of the relocation_hashtable. Signed-off-by: Charlie Jenkins Fixes: d8792a5734b0 ("riscv: Safely remove entries from relocation list") Reported-by: kernel test robot Reported-by: Julia Lawall Closes: https://lore.kernel.org/r/202312120044.wTI1Uyaa-lkp@intel.com/ Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20240104-module_loading_fix-v3-3-a71f8de6ce0f@rivosinc.com Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 91f7cd221afcc..c9d59a5448b6c 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -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;