From: Thorsten Blum Date: Tue, 12 Nov 2024 18:26:34 +0000 (+0100) Subject: x86/sgx: Use vmalloc_array() instead of vmalloc() X-Git-Tag: v6.13-rc1~120^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f060c89dc1a3cfb6db3894e1d96980a568aa355c;p=thirdparty%2Flinux.git x86/sgx: Use vmalloc_array() instead of vmalloc() Use vmalloc_array() instead of vmalloc() to calculate the number of bytes to allocate. Signed-off-by: Thorsten Blum Signed-off-by: Dave Hansen Reviewed-by: Jarkko Sakkinen Acked-by: Kai Huang Link: https://lore.kernel.org/all/20241112182633.172944-2-thorsten.blum%40linux.dev --- diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index 9ace84486499b..1a59e5956f4b4 100644 --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -630,7 +630,7 @@ static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size, if (!section->virt_addr) return false; - section->pages = vmalloc(nr_pages * sizeof(struct sgx_epc_page)); + section->pages = vmalloc_array(nr_pages, sizeof(struct sgx_epc_page)); if (!section->pages) { memunmap(section->virt_addr); return false;