From: Su Hui <suhui@nfschina.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
davem@davemloft.net, herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] crypto: using size_add() for kmalloc()
Date: Mon, 21 Apr 2025 16:46:20 +0800 [thread overview]
Message-ID: <efe80b82-4b64-46cb-97d6-4ae2f4d82b97@nfschina.com> (raw)
In-Reply-To: <5f9b16a3-f3ba-4ccf-bf49-a84c5419d5d2@wanadoo.fr>
On 2025/4/21 16:32, Christophe JAILLET wrote:
> Le 21/04/2025 à 09:43, Su Hui a écrit :
>> On 2025/4/21 15:10, Christophe JAILLET wrote:
>>> Le 21/04/2025 à 07:51, Su Hui a écrit :
>>>> It's safer to use size_add() to replace open-coded aithmetic in
>>>> allocator
>>>> arguments, because size_add() can prevent possible overflow problem.
>>>>
>>>> Signed-off-by: Su Hui <suhui@nfschina.com>
>>>> ---
>>>> include/crypto/aead.h | 3 ++-
>>>> include/crypto/akcipher.h | 4 +++-
>>>> include/crypto/kpp.h | 3 ++-
>>>> 3 files changed, 7 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/include/crypto/aead.h b/include/crypto/aead.h
>>>> index 0e8a41638678..cf212d28fe18 100644
>>>> --- a/include/crypto/aead.h
>>>> +++ b/include/crypto/aead.h
>>>> @@ -10,6 +10,7 @@
>>>> #include <linux/atomic.h>
>>>> #include <linux/container_of.h>
>>>> +#include <linux/overflow.h>
>>>
>>> You could move this 1 line below, to keep alphabetical order.
>>> And why do you say that it is redundant in your follow-up mail?
>> Thanks for your suggestion, I didn't notice this alphabetical order
>> at first :( .
>> Because I found that <linux/crypto.h> includes <linux/slab.h>, and
>> <linux/slab.h> includes <linux/overflow.h>, so this overflow.h is
>> redundant.
>
> It is usually considered best practice to include what is used, and
> not relying on indirect includes.
>
> Should these others includes change one day, then some apparently
> unrelated files will fails to built.
>
I already send a v2 patch, too fast for this v2 sending :(.
v2: https://lore.kernel.org/all/20250421083116.1161805-1-suhui@nfschina.com/
I agreed with 'include what is used'. So I guess v1 is enough and v2
maybe a wrong patchset.
Sorry for the noise.
Su Hui
next prev parent reply other threads:[~2025-04-21 8:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 5:51 Su Hui
2025-04-21 6:27 ` Su Hui
2025-04-21 7:10 ` Christophe JAILLET
2025-04-21 7:43 ` Su Hui
2025-04-21 8:32 ` Christophe JAILLET
2025-04-21 8:46 ` Su Hui [this message]
2025-04-21 8:50 ` Su Hui
2025-04-21 12:05 ` Herbert Xu
2025-04-22 1:30 ` Su Hui
2025-04-22 10:24 ` Dan Carpenter
2025-04-22 14:16 ` Herbert Xu
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=efe80b82-4b64-46cb-97d6-4ae2f4d82b97@nfschina.com \
--to=suhui@nfschina.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.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®