[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <17cbbae6-0b05-4ea3-af04-4db43c40654a@wdc.com>
Date: Mon, 20 Jan 2025 17:16:13 +0000
From: Johannes Thumshirn <Johannes.Thumshirn@....com>
To: Ethan Carter Edwards <ethan@...ancedwards.com>, "manoj@...ux.ibm.com"
<manoj@...ux.ibm.com>
CC: "linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
"kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com>,
Uma Krishnan <ukrishn@...ux.ibm.com>, "James E.J. Bottomley"
<James.Bottomley@...senPartnership.com>, "Martin K. Petersen"
<martin.petersen@...cle.com>, Arnd Bergmann <arnd@...db.de>, Al Viro
<viro@...iv.linux.org.uk>, "linux-scsi@...r.kernel.org"
<linux-scsi@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] scsi: cxlflash: change kzalloc to kcalloc
On 20.01.25 17:55, Ethan Carter Edwards wrote:
> We are replacing any instances of kzalloc(size * count, ...) with
> kcalloc(count, size, ...) due to risk of overflow [1].
>
> [1] https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
>
> Link: https://github.com/KSPP/linux/issues/162
> Signed-off-by: Ethan Carter Edwards <ethan@...ancedwards.com>
> ---
> drivers/scsi/cxlflash/superpipe.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c
> index b375509d1470..fc26e62e0dbf 100644
> --- a/drivers/scsi/cxlflash/superpipe.c
> +++ b/drivers/scsi/cxlflash/superpipe.c
> @@ -785,8 +785,8 @@ static struct ctx_info *create_context(struct cxlflash_cfg *cfg)
> struct sisl_rht_entry *rhte;
>
> ctxi = kzalloc(sizeof(*ctxi), GFP_KERNEL);
> - lli = kzalloc((MAX_RHT_PER_CONTEXT * sizeof(*lli)), GFP_KERNEL);
> - ws = kzalloc((MAX_RHT_PER_CONTEXT * sizeof(*ws)), GFP_KERNEL);
> + lli = kcalloc(MAX_RHT_PER_CONTEXT, sizeof(*lli), GFP_KERNEL);
> + ws = kcalloc(MAX_RHT_PER_CONTEXT, sizeof(*ws), GFP_KERNEL);
> if (unlikely(!ctxi || !lli || !ws)) {
> dev_err(dev, "%s: Unable to allocate context\n", __func__);
> goto err;
JFYI, that driver is deprecated and scheduled for removal by it's maintainers:
https://lore.kernel.org/linux-scsi/20241210054055.144813-3-ajd@linux.ibm.com/
Powered by blists - more mailing lists