[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201125065033.154172-1-miaoqinglang@huawei.com>
Date: Wed, 25 Nov 2020 14:50:33 +0800
From: Qinglang Miao <miaoqinglang@...wei.com>
To: "James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>
CC: <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Qinglang Miao" <miaoqinglang@...wei.com>
Subject: [PATCH] scsi: aic94xx: Fix error return code in asd_process_ms
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@...wei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@...wei.com>
---
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
Powered by blists - more mailing lists