aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Blum <[email protected]>2024-11-12 19:26:34 +0100
committerDave Hansen <[email protected]>2024-11-12 11:11:42 -0800
commitf060c89dc1a3cfb6db3894e1d96980a568aa355c (patch)
tree4518abf4bb5ca7c4327d206f5bb893746c6e9c63
parent2d5404caa8c7bb5c4e0435f94b28834ae5456623 (diff)
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 <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Acked-by: Kai Huang <[email protected]> Link: https://lore.kernel.org/all/20241112182633.172944-2-thorsten.blum%40linux.dev
-rw-r--r--arch/x86/kernel/cpu/sgx/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
index 9ace84486499..1a59e5956f4b 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;