Skip to content

Commit f060c89

Browse files
tobluxhansendc
authored andcommitted
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 <thorsten.blum@linux.dev> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Acked-by: Kai Huang <kai.huang@intel.com> Link: https://lore.kernel.org/all/20241112182633.172944-2-thorsten.blum%40linux.dev
1 parent 2d5404c commit f060c89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/cpu/sgx/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size,
630630
if (!section->virt_addr)
631631
return false;
632632

633-
section->pages = vmalloc(nr_pages * sizeof(struct sgx_epc_page));
633+
section->pages = vmalloc_array(nr_pages, sizeof(struct sgx_epc_page));
634634
if (!section->pages) {
635635
memunmap(section->virt_addr);
636636
return false;

0 commit comments

Comments
 (0)