lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <393CAEF9-A79E-4399-B0F2-FA3BCAD46290@linux.dev>
Date: Mon, 28 Oct 2024 23:47:58 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: "Huang, Kai" <kai.huang@...el.com>
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 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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ