Skip to contentSkip to conversation

scsi: elx: efct: Do not use id uninitialized in efct_lio_setup_session()

PATCH Applied Nathan Chancellor 3 participants 3 messages Jun 17, 2021 – Jun 19, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: elx: efct: Do not use id uninitialized in efct_lio_setup_session()

clang warns:

drivers/scsi/elx/efct/efct_lio.c:1216:24: warning: variable 'id' is uninitialized when used here [-Wuninitialized]

                      se_sess, node, id);
                                     ^~

Shuffle the debug print after id's initialization so that the actual value is printed.

Fixes 692e5d73a811 ("scsi: elx: efct: LIO backend interface routines")
---
 drivers/scsi/elx/efct/efct_lio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/elx/efct/efct_lio.c +3 -3
index e1bab2b17e4d..b7d69ff29c09 100644
@@ -1212,12 +1212,12 @@ static void efct_lio_setup_session(struct work_struct *work)
 		return;
 	}
 
-	efc_log_debug(efct, "new initiator sess=%p node=%p id: %llx\n",
-		      se_sess, node, id);
-
 	tgt_node = node->tgt_node;
 	id = (u64) tgt_node->port_fc_id << 32 | tgt_node->node_fc_id;
 
+	efc_log_debug(efct, "new initiator sess=%p node=%p id: %llx\n",
+		      se_sess, node, id);
+
 	if (xa_err(xa_store(&efct->lookup, id, tgt_node, GFP_KERNEL)))
 		efc_log_err(efct, "Node lookup store failed\n");
 

base-commit: ebc076b3eddc807729bd81f7bc48e798a3ddc477

Signature · 1 line
2.32.0.93.g670b81a890
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Nathan Chancellor

clang warns:

drivers/scsi/elx/efct/efct_lio.c:1216:24: warning: variable 'id' is uninitialized when used here [-Wuninitialized]

                       se_sess, node, id);
                                      ^~

Shuffle the debug print after id's initialization so that the actual value is printed.

Quoted 7 lines
Fixes 692e5d73a811 ("scsi: elx: efct: LIO backend interface routines")
---
  drivers/scsi/elx/efct/efct_lio.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

Thanks

-- james

#2 lore raw
In reply to Nathan Chancellor

Nathan,

Quoted 9 lines

clang warns:

drivers/scsi/elx/efct/efct_lio.c:1216:24: warning: variable 'id' is uninitialized when used here [-Wuninitialized]

                      se_sess, node, id);
                                     ^~

Shuffle the debug print after id's initialization so that the actual value is printed.

Applied to 5.14/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering