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@xxxxxxxxxx> Signed-off-by: Qinglang Miao <miaoqinglang@xxxxxxxxxx> --- drivers/scsi/aic94xx/aic94xx_sds.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); -- 2.23.0