Re: [RESEND PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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.





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux