[PATCH] scsi: aic94xx: Fix error return code in asd_process_ms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux