lkml.org 
[lkml]   [2021]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] scsi: core: initialize cmd->cmnd before it is used
From
Date
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.

\
 
 \ /
  Last update: 2021-11-01 21:07    [W:0.051 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site