mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] scsi: scsi_debug: Fix addition of uninitialized variable len
@ 2025-02-25 16:13 Colin Ian King
  0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2025-02-25 16:13 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen, Kai Mäkisara,
	John Meneghini, linux-scsi
  Cc: kernel-janitors, linux-kernel

There is an addition on a previously uninitialized variable len that
results in an undefined result. Fix this by making the addition an
assignment. Issue detected with static analysis.

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

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/scsi/scsi_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 722ee8c067ae..f3e9a63bbf02 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -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) */
-- 
2.47.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-25 16:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-25 16:13 [PATCH][next] scsi: scsi_debug: Fix addition of uninitialized variable len Colin Ian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®