mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Tadeusz Struk <tadeusz.struk@linaro.org>, linux-scsi@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	syzbot+5516b30f5401d4dcbcae@syzkaller.appspotmail.com
Subject: Re: [PATCH] scsi: core: initialize cmd->cmnd before it is used
Date: Mon, 1 Nov 2021 13:06:16 -0700	[thread overview]
Message-ID: <4cfa4049-aae5-51db-4ad2-b4c9db996525@acm.org> (raw)
In-Reply-To: <20211101192417.324799-1-tadeusz.struk@linaro.org>

On 11/1/21 12:24 PM, Tadeusz Struk wrote:
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 572673873ddf..cd4b57747448 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1173,10 +1173,10 @@ static blk_status_t scsi_setup_scsi_cmnd(struct scsi_device *sdev,
>   		memset(&cmd->sdb, 0, sizeof(cmd->sdb));
>   	}
>   
> +	cmd->cmnd = scsi_req(req)->cmd;
>   	cmd->cmd_len = scsi_req(req)->cmd_len;
>   	if (cmd->cmd_len == 0)
>   		cmd->cmd_len = scsi_command_size(cmd->cmnd);
> -	cmd->cmnd = scsi_req(req)->cmd;
>   	cmd->transfersize = blk_rq_bytes(req);
>   	cmd->allowed = scsi_req(req)->retries;
>   	return BLK_STS_OK;

This patch is a duplicate and has been posted before.

Please take a look at https://lore.kernel.org/linux-scsi/20210904064534.1919476-1-qiulaibin@huawei.com/.
 From the replies to that email:
"> Thinking further about this: is there any code left that depends on
 > scsi_setup_scsi_cmnd() setting cmd->cmd_len? Can the cmd->cmd_len
 > assignment be removed from scsi_setup_scsi_cmnd()?

cmd_len should never be 0 now, so I think we can remove it."

Thanks,

Bart.


  reply	other threads:[~2021-11-01 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 19:24 Tadeusz Struk
2021-11-01 20:06 ` Bart Van Assche [this message]
2021-11-01 20:13   ` Tadeusz Struk
2021-11-01 20:20     ` Bart Van Assche
2021-11-02  1:56       ` Douglas Gilbert
2021-11-02  3:06         ` Bart Van Assche
2021-11-02 21:33           ` Douglas Gilbert
2021-11-02 22:22             ` Tadeusz Struk
2021-11-02 22:27               ` Bart Van Assche
2021-11-02 23:01                 ` Tadeusz Struk

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=4cfa4049-aae5-51db-4ad2-b4c9db996525@acm.org \
    --to=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+5516b30f5401d4dcbcae@syzkaller.appspotmail.com \
    --cc=tadeusz.struk@linaro.org \
    /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®