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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ce7c2b7e-eb7c-4087-aac2-697fd8f587a5@vivo.com>
Date: Thu, 21 Aug 2025 21:05:11 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Giovanni Cabiddu <giovanni.cabiddu@...el.com>,
 Herbert Xu <herbert@...dor.apana.org.au>,
 "David S. Miller" <davem@...emloft.net>, Jack Xu <jack.xu@...el.com>,
 Suman Kumar Chakraborty <suman.kumar.chakraborty@...el.com>,
 Colin Ian King <colin.i.king@...il.com>, qat-linux@...el.com,
 linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: qat - use kcalloc() in
 qat_uclo_map_objs_from_mof()


在 2025/8/21 20:56, Andy Shevchenko 写道:
> [You don't often get email from andriy.shevchenko@...ux.intel.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> On Thu, Aug 21, 2025 at 08:35:42PM +0800, Qianfeng Rong wrote:
>> As noted in the kernel documentation [1], open-coded multiplication in
>> allocator arguments is discouraged because it can lead to integer overflow.
>>
>> Use kcalloc() to gain built-in overflow protection, making memory
>> allocation safer when calculating allocation size compared to explicit
>> multiplication.
>> [1]: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
>>
>> Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
> Make it a Link tag.
>
> Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments #1
> Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
>
> (also note no blank lines in tag block)
Thank you, Andy—I've learned another useful detail.
>
> ...
>
>> -     mobj_hdr = kzalloc((uobj_chunk_num + sobj_chunk_num) *
>> +     mobj_hdr = kcalloc(uobj_chunk_num + sobj_chunk_num,
> size_add() ?
Yes, similar to array_size(), using size_add() here is safer.  I will 
post v2 later.
>
>>                           sizeof(*mobj_hdr), GFP_KERNEL);
>>        if (!mobj_hdr)
>>                return -ENOMEM;
> --
> With Best Regards,
> Andy Shevchenko
Best regards,
Qianfeng


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ