Skip to contentSkip to conversation

scsi: scsi_dh_alua: signedness bug in alua_rtpg()

PATCH Applied Dan Carpenter 3 participants 4 messages Jun 3, 2021 – Jun 16, 2021

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

PATCH 1/1 scsi: scsi_dh_alua: signedness bug in alua_rtpg()

The "retval" variable needs to be signed for the error handling to work.

Fixes 7e26e3ea0287 ("scsi: scsi_dh_alua: Check for negative result value")
---
 drivers/scsi/device_handler/scsi_dh_alua.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/device_handler/scsi_dh_alua.c +2 -1
index 7baee18ebd03..37d06f993b76 100644
@@ -518,7 +518,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
 	int len, k, off, bufflen = ALUA_RTPG_SIZE;
 	int group_id_old, state_old, pref_old, valid_states_old;
 	unsigned char *desc, *buff;
-	unsigned err, retval;
+	unsigned err;
+	int retval;
 	unsigned int tpg_desc_tbl_off;
 	unsigned char orig_transition_tmo;
 	unsigned long flags;
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dan Carpenter

The "retval" variable needs to be signed for the error handling to work.

Fixes 7e26e3ea0287 ("scsi: scsi_dh_alua: Check for negative result

value")

Quoted 20 lines

---
 drivers/scsi/device_handler/scsi_dh_alua.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/device_handler/scsi_dh_alua.c +2 -1
index 7baee18ebd03..37d06f993b76 100644
@@ -518,7 +518,8 @@ static int alua_rtpg(struct scsi_device *sdev,
 struct alua_port_group *pg)
         int len, k, off, bufflen = ALUA_RTPG_SIZE;
         int group_id_old, state_old, pref_old, valid_states_old;
         unsigned char *desc, *buff;
-       unsigned err, retval;
+       unsigned err;
+       int retval;
         unsigned int tpg_desc_tbl_off;
         unsigned char orig_transition_tmo;

        unsigned long flags;

#2 lore raw
In reply to Dan Carpenter

Dan,

Quoted 1 line

The "retval" variable needs to be signed for the error handling to work.

Applied to 5.14/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering