From: "Huang, Kai" <kai.huang@intel.com>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Jarkko Sakkinen <jarkko@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
<x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
<linux-sgx@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()
Date: Tue, 29 Oct 2024 11:51:15 +1300 [thread overview]
Message-ID: <fbbca51f-267c-496e-b30d-6075ac684097@intel.com> (raw)
In-Reply-To: <393CAEF9-A79E-4399-B0F2-FA3BCAD46290@linux.dev>
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.
next prev parent reply other threads:[~2024-10-28 22:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 11:32 Thorsten Blum
2024-10-28 22:29 ` Huang, Kai
2024-10-28 22:47 ` Thorsten Blum
2024-10-28 22:51 ` Huang, Kai [this message]
2024-11-12 18:26 Thorsten Blum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fbbca51f-267c-496e-b30d-6075ac684097@intel.com \
--to=kai.huang@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jarkko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=thorsten.blum@linux.dev \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®