linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qinglang Miao <miaoqinglang@huawei.com>
To: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Qinglang Miao" <miaoqinglang@huawei.com>
Subject: [PATCH] scsi: aic94xx: Fix error return code in asd_process_ms
Date: Wed, 25 Nov 2020 14:50:33 +0800	[thread overview]
Message-ID: <20201125065033.154172-1-miaoqinglang@huawei.com> (raw)

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(-)

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


                 reply	other threads:[~2020-11-25  6:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201125065033.154172-1-miaoqinglang@huawei.com \
    --to=miaoqinglang@huawei.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).