All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wen Zhiwei <wenzhiwei@kylinos.cn>
To: subbu.seetharaman@broadcom.com, ketan.mukadam@broadcom.com,
	jitendra.bhivare@broadcom.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: be2iscsi:Fix the problem that the array may be out of bounds
Date: Sat, 20 Nov 2021 08:32:33 +0800	[thread overview]
Message-ID: <20211120003233.69789-1-wenzhiwei@kylinos.cn> (raw)

By observing that the value of ulp_num may be
'BEISCSI_ULP_COUNT',this will cause the problem
of data out of bounds.Increase judgments to
eliminate risks.

Signed-off-by: Wen Zhiwei <wenzhiwei@kylinos.cn>
---
 drivers/scsi/be2iscsi/be_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index ab55681145f8..392a53184a00 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3947,7 +3947,8 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
 	for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++)
 		if (test_bit(ulp_num, &phba->fw_config.ulp_supported))
 			break;
-
+	if (ulp_num >= BEISCSI_ULP_COUNT)
+		return -ENOMEM;
 	ulp_icd_start = phba->fw_config.iscsi_icd_start[ulp_num];
 
 	arr_index = 0;
-- 
2.30.0


                 reply	other threads:[~2021-11-22  4:30 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=20211120003233.69789-1-wenzhiwei@kylinos.cn \
    --to=wenzhiwei@kylinos.cn \
    --cc=jejb@linux.ibm.com \
    --cc=jitendra.bhivare@broadcom.com \
    --cc=ketan.mukadam@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=subbu.seetharaman@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.