Skip to contentSkip to conversation

target: initialize sense_reason_t ret in core_scsi3_emulate_pro_register()

PATCH In review Geert Uytterhoeven 2 participants 2 messages Dec 22, 2012 – Jan 9, 2013

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

PATCH 1/1 target: initialize sense_reason_t ret in core_scsi3_emulate_pro_register()

drivers/target/target_core_pr.c: In function ‘core_scsi3_emulate_pro_register’:
drivers/target/target_core_pr.c:2056: warning: ‘ret’ may be used uninitialized in this function

If !spec_i_pt, the "goto out_put_pr_reg" on line 2141 seems to be a real case where ret is not initialized.

---
 drivers/target/target_core_pr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/target/target_core_pr.c +1 -1
index e35dbf8..c2e8026 100644
@@ -2053,7 +2053,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
 	/* Used for APTPL metadata w/ UNREGISTER */
 	unsigned char *pr_aptpl_buf = NULL;
 	unsigned char isid_buf[PR_REG_ISID_LEN], *isid_ptr = NULL;
-	sense_reason_t ret;
+	sense_reason_t ret = 0;
 	int pr_holder = 0, type;
 
 	if (!se_sess || !se_lun) {
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Geert,

Apologies for the delay on this one. Still catching up on some older holiday items..

Quoted 16 lines · Geert Uytterhoeven

drivers/target/target_core_pr.c: In function ‘core_scsi3_emulate_pro_register’:
drivers/target/target_core_pr.c:2056: warning: ‘ret’ may be used uninitialized in this function

If !spec_i_pt, the "goto out_put_pr_reg" on line 2141 seems to be a real case where ret is not initialized.

---
 drivers/target/target_core_pr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/target/target_core_pr.c +0 -0
index e35dbf8..c2e8026 100644

drivers/target/target_core_pr.c core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key, · line 2059

Quoted 8 lines
drivers/target/target_core_pr.c +1 -1
@@ -2053,7 +2053,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
 	/* Used for APTPL metadata w/ UNREGISTER */
 	unsigned char *pr_aptpl_buf = NULL;
 	unsigned char isid_buf[PR_REG_ISID_LEN], *isid_ptr = NULL;
-	sense_reason_t ret;
+	sense_reason_t ret = 0;
 	int pr_holder = 0, type;
 
 	if (!se_sess || !se_lun) {

Looks fine, applied to target-pending/master.

Thank you,

--nab