Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bart Van Assche" <bvanassche@acm.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/7] scsi: scsi_debug: Split resp_write_same()
Date: Tue, 22 Sep 2026 23:38:26 +0000	[thread overview]
Message-ID: <20260922233826.D0B651F000FF@smtp.kernel.org> (raw)
In-Reply-To: <ffc8a3e12ea887344ed6529de190235944f87b45.1790119506.git.bvanassche@acm.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] scsi: scsi_debug: error code clobbered in __resp_write_same()
--

commit 696b9f54842f667ad884ebcdfbd0d4e29f77e149
Author: Bart Van Assche <bvanassche@acm.org>

scsi: scsi_debug: Split resp_write_same()
    
Since the Clang thread-safety analyzer does not support conditional
locking, split the function resp_write_same() such that all locking
statements end up in the same branch of an if-statement.

> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index b854102e6caa1..a44886a4c8539 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
[ ... ]
> @@ -5422,9 +5415,25 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num,
>  unlock:
>  	sdeb_data_write_unlock(sip);
>  	ret = 0;
> -out:
> -	if (meta_data_locked)
> +	return ret;

[Severity: High]
If fetch_to_dev_buffer() fails and returns -1, the code earlier in
__resp_write_same() sets ret = DID_ERROR << 16 and jumps to the unlock label:

	if (-1 == ret) {
		ret = DID_ERROR << 16;
		goto unlock;
	}

Does this code unconditionally overwrite the captured error code and return 0,
silently masking the write failure?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1790119506.git.bvanassche@acm.org?part=2

  reply	other threads:[~2026-09-22 23:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 23:26 [PATCH 0/7] scsi_debug: Enable lock context analysis Bart Van Assche
2026-09-22 23:26 ` [PATCH 1/7] scsi: scsi_debug: Fix a locking bug in resp_write_same() Bart Van Assche
2026-09-22 23:32   ` sashiko-bot
2026-09-23  7:37   ` John Garry
2026-09-23  7:44     ` John Garry
2026-09-23 19:39     ` Bart Van Assche
2026-09-22 23:26 ` [PATCH 2/7] scsi: scsi_debug: Split resp_write_same() Bart Van Assche
2026-09-22 23:38   ` sashiko-bot [this message]
2026-09-22 23:26 ` [PATCH 3/7] scsi: scsi_debug: Split corrupt_lbas() Bart Van Assche
2026-09-22 23:26 ` [PATCH 4/7] scsi: scsi_debug: Split resp_read_dt0() Bart Van Assche
2026-09-22 23:37   ` sashiko-bot
2026-09-22 23:26 ` [PATCH 5/7] scsi: scsi_debug: Split resp_write_dt0() Bart Van Assche
2026-09-22 23:41   ` sashiko-bot
2026-09-22 23:26 ` [PATCH 6/7] scsi: scsi_debug: Improve lock context annotations Bart Van Assche
2026-09-22 23:41   ` sashiko-bot
2026-09-22 23:26 ` [PATCH 7/7] scsi: core: Enable lock context analysis for the scsi_debug driver Bart Van Assche

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=20260922233826.D0B651F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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