Message ID | 20201125065033.154172-1-miaoqinglang@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | scsi: aic94xx: Fix error return code in asd_process_ms | expand |
diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c index 105adba55..3aad00458 100644 --- a/drivers/scsi/aic94xx/aic94xx_sds.c +++ b/drivers/scsi/aic94xx/aic94xx_sds.c @@ -860,8 +860,10 @@ static int asd_process_ms(struct asd_ha_struct *asd_ha, goto out; } - if (size == 0) + if (size == 0) { + err = -EINVAL; goto out; + } err = -ENOMEM; manuf_sec = kmalloc(size, GFP_KERNEL); @@ -989,8 +991,10 @@ static int asd_process_ctrl_a_user(struct asd_ha_struct *asd_ha, goto out_process; } - if (size == 0) + if (size == 0) { + err = -EINVAL; goto out; + } err = -ENOMEM; el = kmalloc(size, GFP_KERNEL);
Fix to return the error code -EINVAL when size == 0 after asd_find_flash_de instead of zero. Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> --- drivers/scsi/aic94xx/aic94xx_sds.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)