mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
To: James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com
Cc: satishkh@cisco.com, kartilak@cisco.com, sebaddel@cisco.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
Subject: [PATCH scsi-next] scsi: fnic: Fix use of uninitialized value in debug message
Date: Wed,  8 Jan 2025 10:39:16 +0530	[thread overview]
Message-ID: <20250108050916.52721-1-dheeraj.linuxdev@gmail.com> (raw)

The oxid variable in fdls_process_abts_req() was only being initialized
inside the if (tport) block, but was being used in a debug print statement
after that block. If tport was NULL, oxid would remain uninitialized.
Move the oxid initialization to happen at declaration using
FNIC_STD_GET_OX_ID(fchdr).

Fixes: f828af44b8dd ("scsi: fnic: Add support for unsolicited requests and responses")
Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602772
Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
---
 drivers/scsi/fnic/fdls_disc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/fnic/fdls_disc.c b/drivers/scsi/fnic/fdls_disc.c
index 2534af2fff53..266d9f090772 100644
--- a/drivers/scsi/fnic/fdls_disc.c
+++ b/drivers/scsi/fnic/fdls_disc.c
@@ -3904,7 +3904,7 @@ fdls_process_abts_req(struct fnic_iport_s *iport, struct fc_frame_header *fchdr)
 	uint8_t *frame;
 	struct fc_std_abts_ba_acc *pba_acc;
 	uint32_t nport_id;
-	uint16_t oxid;
+	uint16_t oxid = FNIC_STD_GET_OX_ID(fchdr);
 	struct fnic_tport_s *tport;
 	struct fnic *fnic = iport->fnic;
 	uint16_t frame_size = FNIC_ETH_FCOE_HDRS_OFFSET +
@@ -3916,7 +3916,6 @@ fdls_process_abts_req(struct fnic_iport_s *iport, struct fc_frame_header *fchdr)
 
 	tport = fnic_find_tport_by_fcid(iport, nport_id);
 	if (tport) {
-		oxid = FNIC_STD_GET_OX_ID(fchdr);
 		if (tport->active_oxid == oxid) {
 			tport->flags |= FNIC_FDLS_TGT_ABORT_ISSUED;
 			fdls_free_oxid(iport, oxid, &tport->active_oxid);
-- 
2.34.1


             reply	other threads:[~2025-01-08  5:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08  5:09 Dheeraj Reddy Jonnalagadda [this message]
2025-01-08  5:19 ` Karan Tilak Kumar (kartilak)

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=20250108050916.52721-1-dheeraj.linuxdev@gmail.com \
    --to=dheeraj.linuxdev@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=kartilak@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=satishkh@cisco.com \
    --cc=sebaddel@cisco.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

all inboxes | Powered by JetHome®