scsi: cxlflash: change kzalloc to kcalloc
PATCH 1/1 scsi: cxlflash: change kzalloc to kcalloc
We are replacing any instances of kzalloc(size * count, ...) with kcalloc(count, size, ...) due to risk of overflow [1].
--- drivers/scsi/cxlflash/superpipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/cxlflash/superpipe.c +2 -2
@@ -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;
Signature · 1 line
2.48.0
Quoted 16 lines · Ethan Carter Edwards
We are replacing any instances of
kzalloc(size * count, ...)withkcalloc(count, size, ...)due to risk of overflow [1].--- drivers/scsi/cxlflash/superpipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/cxlflash/superpipe.c +0
-0
drivers/scsi/cxlflash/superpipe.c static struct ctx_info *create_context(struct cxlflash_cfg *cfg) · line 792
Quoted 10 lines
drivers/scsi/cxlflash/superpipe.c +2
-2@@ -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: