[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fbbca51f-267c-496e-b30d-6075ac684097@intel.com>
Date: Tue, 29 Oct 2024 11:51:15 +1300
From: "Huang, Kai" <kai.huang@...el.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
CC: Jarkko Sakkinen <jarkko@...nel.org>, Dave Hansen
<dave.hansen@...ux.intel.com>, Thomas Gleixner <tglx@...utronix.de>, "Ingo
Molnar" <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>, <linux-sgx@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [RESEND PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()
On 29/10/2024 11:47 am, Thorsten Blum wrote:
> On 28. Oct 2024, at 23:29, Huang, Kai wrote:
>> On 27/10/2024 12:32 am, Thorsten Blum wrote:
>>> Use vmalloc_array() instead of vmalloc() to calculate the number of
>>> bytes to allocate.
>>
>> This says nothing about _why_. Is it because we want to take advantage of the multiplication overflow check inside the vmalloc_array()?
>>
>> I don't know whether it is implied we should always use vmalloc_array() for array allocation like this, i.e., when we see vmalloc() is used for array allocation in the kernel we can just write a patch to replace it with vmalloc_array() and send to upstream.
>
> It's discouraged to use open-coded arithmetic in allocator arguments:
>
> https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
>
> Happy to add this, but I assumed it's obvious.
Thanks for the info.
Powered by blists - more mailing lists