diff options
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index d545ad1cf47a..a82d2fe80fb5 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -445,7 +445,7 @@ static void scsi_init_cmd_errh(struct scsi_cmnd *cmd) | |||
445 | scsi_set_resid(cmd, 0); | 445 | scsi_set_resid(cmd, 0); |
446 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | 446 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
447 | if (cmd->cmd_len == 0) | 447 | if (cmd->cmd_len == 0) |
448 | cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); | 448 | cmd->cmd_len = scsi_command_size(cmd->cmnd); |
449 | } | 449 | } |
450 | 450 | ||
451 | void scsi_device_unbusy(struct scsi_device *sdev) | 451 | void scsi_device_unbusy(struct scsi_device *sdev) |
@@ -1094,6 +1094,8 @@ static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev, | |||
1094 | cmd->tag = req->tag; | 1094 | cmd->tag = req->tag; |
1095 | cmd->request = req; | 1095 | cmd->request = req; |
1096 | 1096 | ||
1097 | cmd->cmnd = req->cmd; | ||
1098 | |||
1097 | return cmd; | 1099 | return cmd; |
1098 | } | 1100 | } |
1099 | 1101 | ||
@@ -1131,8 +1133,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | |||
1131 | req->buffer = NULL; | 1133 | req->buffer = NULL; |
1132 | } | 1134 | } |
1133 | 1135 | ||
1134 | BUILD_BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd)); | ||
1135 | memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); | ||
1136 | cmd->cmd_len = req->cmd_len; | 1136 | cmd->cmd_len = req->cmd_len; |
1137 | if (!req->data_len) | 1137 | if (!req->data_len) |
1138 | cmd->sc_data_direction = DMA_NONE; | 1138 | cmd->sc_data_direction = DMA_NONE; |
@@ -1169,6 +1169,7 @@ int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req) | |||
1169 | if (unlikely(!cmd)) | 1169 | if (unlikely(!cmd)) |
1170 | return BLKPREP_DEFER; | 1170 | return BLKPREP_DEFER; |
1171 | 1171 | ||
1172 | memset(cmd->cmnd, 0, BLK_MAX_CDB); | ||
1172 | return scsi_init_io(cmd, GFP_ATOMIC); | 1173 | return scsi_init_io(cmd, GFP_ATOMIC); |
1173 | } | 1174 | } |
1174 | EXPORT_SYMBOL(scsi_setup_fs_cmnd); | 1175 | EXPORT_SYMBOL(scsi_setup_fs_cmnd); |