]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: scsi_debug: Fix uninitialized variable use
authorArnd Bergmann <arnd@arndb.de>
Tue, 25 Feb 2025 09:56:47 +0000 (10:56 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 3 Mar 2025 02:07:58 +0000 (21:07 -0500)
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")
Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250225095651.2636811-1-arnd@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c

index 2208dcba346edc41a6be58ea41cec30e81d295cb..523f054912e1477102dcb83a7abc42d43d34ecbb 100644 (file)
@@ -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) */