mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Qianfeng Rong <rongqianfeng@vivo.com>
Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Jack Xu <jack.xu@intel.com>,
	Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>,
	Colin Ian King <colin.i.king@gmail.com>,
	qat-linux@intel.com, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: qat - use kcalloc() in qat_uclo_map_objs_from_mof()
Date: Thu, 21 Aug 2025 15:56:55 +0300	[thread overview]
Message-ID: <aKcXlxNRDr5IQYwh@smile.fi.intel.com> (raw)
In-Reply-To: <20250821123544.629821-1-rongqianfeng@vivo.com>

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@vivo.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@vivo.com>

(also note no blank lines in tag block)

...

> -	mobj_hdr = kzalloc((uobj_chunk_num + sobj_chunk_num) *
> +	mobj_hdr = kcalloc(uobj_chunk_num + sobj_chunk_num,

size_add() ?

>  			   sizeof(*mobj_hdr), GFP_KERNEL);
>  	if (!mobj_hdr)
>  		return -ENOMEM;

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-08-21 12:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21 12:35 Qianfeng Rong
2025-08-21 12:56 ` Andy Shevchenko [this message]
2025-08-21 13:05   ` Qianfeng Rong

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=aKcXlxNRDr5IQYwh@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=colin.i.king@gmail.com \
    --cc=davem@davemloft.net \
    --cc=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jack.xu@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=rongqianfeng@vivo.com \
    --cc=suman.kumar.chakraborty@intel.com \
    /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®