Skip to contentSkip to conversation

scsi: scsi_debug: fix uninitialized variable use

PATCH Applied Arnd Bergmann 2 participants 2 messages Feb 25, 2025 – Mar 4, 2025 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scsi: scsi_debug: fix uninitialized variable use

From: Arnd Bergmann <[email protected]>

It appears that a typo has made it into the newly added code

drivers/scsi/scsi_debug.c:3035:3: error: variable 'len' is uninitialized when used here [-Werror,-Wuninitialized]

 3035 |                 len += resp_compression_m_pg(ap, pcontrol, target, devip->tape_dce);
      |                 ^~~

Replace the '+=' with the intended '=' here.

Fixes 568354b24c7d ("scsi: scsi_debug: Add compression mode page for tapes")

---
v2: use the correct 'Fixes' tag

---
 drivers/scsi/scsi_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
index 722ee8c067ae..f3e9a63bbf02 100644
@@ -3032,7 +3032,7 @@ static int resp_mode_sense(struct scsi_cmnd *scp,
 	case 0xf:	/* Compression Mode Page (tape) */
 		if (!is_tape)
 			goto bad_pcode;
-		len += resp_compression_m_pg(ap, pcontrol, target, devip->tape_dce);
+		len = resp_compression_m_pg(ap, pcontrol, target, devip->tape_dce);
 		offset += len;
 		break;
 	case 0x11:	/* Partition Mode Page (tape) */
Signature · 1 line
2.39.5
#1 lore raw

Arnd,

Quoted 7 lines

It appears that a typo has made it into the newly added code

drivers/scsi/scsi_debug.c:3035:3: error: variable 'len' is uninitialized when used here [-Werror,-Wuninitialized]

 3035 |                 len += resp_compression_m_pg(ap, pcontrol, target, devip->tape_dce);
      |                 ^~~

Replace the '+=' with the intended '=' here.

Applied to 6.15/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering