* [PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()
@ 2024-09-29 10:56 Thorsten Blum
2024-10-07 23:29 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-09-29 10:56 UTC (permalink / raw)
To: Jarkko Sakkinen, Dave Hansen, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, x86, H. Peter Anvin
Cc: Thorsten Blum, linux-sgx, linux-kernel
Use vmalloc_array() instead of vmalloc() to calculate the number of
bytes to allocate.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/x86/kernel/cpu/sgx/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.46.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()
2024-09-29 10:56 [PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc() Thorsten Blum
@ 2024-10-07 23:29 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2024-10-07 23:29 UTC (permalink / raw)
To: Thorsten Blum, Dave Hansen, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, x86, H. Peter Anvin
Cc: linux-sgx, linux-kernel
On Sun, 2024-09-29 at 12:56 +0200, Thorsten Blum wrote:
> Use vmalloc_array() instead of vmalloc() to calculate the number of
> bytes to allocate.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> arch/x86/kernel/cpu/sgx/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
BR, Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-07 23:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-29 10:56 [PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc() Thorsten Blum
2024-10-07 23:29 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox