From: Colin Ian King <colin.i.king@gmail.com>
To: "James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
"Kai Mäkisara" <Kai.Makisara@kolumbus.fi>,
"John Meneghini" <jmeneghi@redhat.com>,
linux-scsi@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] scsi: scsi_debug: Fix addition of uninitialized variable len
Date: Tue, 25 Feb 2025 16:13:24 +0000 [thread overview]
Message-ID: <20250225161324.184873-1-colin.i.king@gmail.com> (raw)
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
reply other threads:[~2025-02-25 16:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250225161324.184873-1-colin.i.king@gmail.com \
--to=colin.i.king@gmail.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Kai.Makisara@kolumbus.fi \
--cc=jmeneghi@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®