Skip to content

Commit

Permalink
x86/sgx: Use vmalloc_array() instead of vmalloc()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Thorsten Blum authored and Dave Hansen committed Nov 12, 2024
1 parent 2d5404c commit f060c89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/sgx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f060c89

Please sign in to comment.