diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2008-04-30 04:19:47 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-05-02 11:18:22 -0400 |
commit | 64a87b244b9297667ca80264aab849a36f494884 (patch) | |
tree | 554d78d1cfe594b92409a19b3ed1d32efcbd31cc /drivers | |
parent | 9f5de6b105bfa45911d46566df0b36720b648c42 (diff) |
[SCSI] Let scsi_cmnd->cmnd use request->cmd buffer
- struct scsi_cmnd had a 16 bytes command buffer of its own.
This is an unnecessary duplication and copy of request's
cmd. It is probably left overs from the time that scsi_cmnd
could function without a request attached. So clean that up.
- Once above is done, few places, apart from scsi-ml, needed
adjustments due to changing the data type of scsi_cmnd->cmnd.
- Lots of drivers still use MAX_COMMAND_SIZE. So I have left
that #define but equate it to BLK_MAX_CDB. The way I see it
and is reflected in the patch below is.
MAX_COMMAND_SIZE - means: The longest fixed-length (*) SCSI CDB
as per the SCSI standard and is not related
to the implementation.
BLK_MAX_CDB. - The allocated space at the request level
- I have audit all ISA drivers and made sure none use ->cmnd in a DMA
Operation. Same audit was done by Andi Kleen.
(*)fixed-length here means commands that their size can be determined
by their opcode and the CDB does not carry a length specifier, (unlike
the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly
true and the SCSI standard also defines extended commands and
vendor specific commands that can be bigger than 16 bytes. The kernel
will support these using the same infrastructure used for VARLEN CDB's.
So in effect MAX_COMMAND_SIZE means the maximum size command
scsi-ml supports without specifying a cmd_len by ULD's
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firewire/fw-sbp2.c | 2 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 2 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 2 | ||||
-rw-r--r-- | drivers/scsi/53c700.c | 6 | ||||
-rw-r--r-- | drivers/scsi/a100u2w.c | 2 | ||||
-rw-r--r-- | drivers/scsi/gdth.c | 2 | ||||
-rw-r--r-- | drivers/scsi/hptiop.c | 6 | ||||
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvscsi.c | 2 | ||||
-rw-r--r-- | drivers/scsi/initio.c | 2 | ||||
-rw-r--r-- | drivers/scsi/qla1280.c | 4 | ||||
-rw-r--r-- | drivers/scsi/scsi_error.c | 15 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 5 | ||||
-rw-r--r-- | drivers/scsi/scsi_tgt_lib.c | 2 | ||||
-rw-r--r-- | drivers/usb/storage/cypress_atacb.c | 2 | ||||
-rw-r--r-- | drivers/usb/storage/isd200.c | 2 |
15 files changed, 31 insertions, 25 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 2a999373863e..dda82f37cab3 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -1487,7 +1487,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1487 | if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0) | 1487 | if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0) |
1488 | goto out; | 1488 | goto out; |
1489 | 1489 | ||
1490 | memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd)); | 1490 | memcpy(orb->request.command_block, cmd->cmnd, cmd->cmd_len); |
1491 | 1491 | ||
1492 | orb->base.callback = complete_command_orb; | 1492 | orb->base.callback = complete_command_orb; |
1493 | orb->base.request_bus = | 1493 | orb->base.request_bus = |
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 37b85c67b11d..c8bad675dbd1 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -1055,7 +1055,7 @@ static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, | |||
1055 | rec->scsi_result = scsi_cmnd->result; | 1055 | rec->scsi_result = scsi_cmnd->result; |
1056 | rec->scsi_cmnd = (unsigned long)scsi_cmnd; | 1056 | rec->scsi_cmnd = (unsigned long)scsi_cmnd; |
1057 | rec->scsi_serial = scsi_cmnd->serial_number; | 1057 | rec->scsi_serial = scsi_cmnd->serial_number; |
1058 | memcpy(rec->scsi_opcode, &scsi_cmnd->cmnd, | 1058 | memcpy(rec->scsi_opcode, scsi_cmnd->cmnd, |
1059 | min((int)scsi_cmnd->cmd_len, | 1059 | min((int)scsi_cmnd->cmd_len, |
1060 | ZFCP_DBF_SCSI_OPCODE)); | 1060 | ZFCP_DBF_SCSI_OPCODE)); |
1061 | rec->scsi_retries = scsi_cmnd->retries; | 1061 | rec->scsi_retries = scsi_cmnd->retries; |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 9af2330f07a2..b2ea4ea051f5 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -4014,7 +4014,7 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req) | |||
4014 | ZFCP_LOG_TRACE("scpnt->result =0x%x, command was:\n", | 4014 | ZFCP_LOG_TRACE("scpnt->result =0x%x, command was:\n", |
4015 | scpnt->result); | 4015 | scpnt->result); |
4016 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, | 4016 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, |
4017 | (void *) &scpnt->cmnd, scpnt->cmd_len); | 4017 | scpnt->cmnd, scpnt->cmd_len); |
4018 | 4018 | ||
4019 | ZFCP_LOG_TRACE("%i bytes sense data provided by FCP\n", | 4019 | ZFCP_LOG_TRACE("%i bytes sense data provided by FCP\n", |
4020 | fcp_rsp_iu->fcp_sns_len); | 4020 | fcp_rsp_iu->fcp_sns_len); |
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index f4c4fe90240a..f5a9addb7050 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -599,7 +599,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, | |||
599 | (struct NCR_700_command_slot *)SCp->host_scribble; | 599 | (struct NCR_700_command_slot *)SCp->host_scribble; |
600 | 600 | ||
601 | dma_unmap_single(hostdata->dev, slot->pCmd, | 601 | dma_unmap_single(hostdata->dev, slot->pCmd, |
602 | sizeof(SCp->cmnd), DMA_TO_DEVICE); | 602 | MAX_COMMAND_SIZE, DMA_TO_DEVICE); |
603 | if (slot->flags == NCR_700_FLAG_AUTOSENSE) { | 603 | if (slot->flags == NCR_700_FLAG_AUTOSENSE) { |
604 | char *cmnd = NCR_700_get_sense_cmnd(SCp->device); | 604 | char *cmnd = NCR_700_get_sense_cmnd(SCp->device); |
605 | #ifdef NCR_700_DEBUG | 605 | #ifdef NCR_700_DEBUG |
@@ -1004,7 +1004,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
1004 | * here */ | 1004 | * here */ |
1005 | NCR_700_unmap(hostdata, SCp, slot); | 1005 | NCR_700_unmap(hostdata, SCp, slot); |
1006 | dma_unmap_single(hostdata->dev, slot->pCmd, | 1006 | dma_unmap_single(hostdata->dev, slot->pCmd, |
1007 | sizeof(SCp->cmnd), | 1007 | MAX_COMMAND_SIZE, |
1008 | DMA_TO_DEVICE); | 1008 | DMA_TO_DEVICE); |
1009 | 1009 | ||
1010 | cmnd[0] = REQUEST_SENSE; | 1010 | cmnd[0] = REQUEST_SENSE; |
@@ -1901,7 +1901,7 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) | |||
1901 | } | 1901 | } |
1902 | slot->resume_offset = 0; | 1902 | slot->resume_offset = 0; |
1903 | slot->pCmd = dma_map_single(hostdata->dev, SCp->cmnd, | 1903 | slot->pCmd = dma_map_single(hostdata->dev, SCp->cmnd, |
1904 | sizeof(SCp->cmnd), DMA_TO_DEVICE); | 1904 | MAX_COMMAND_SIZE, DMA_TO_DEVICE); |
1905 | NCR_700_start_command(SCp); | 1905 | NCR_700_start_command(SCp); |
1906 | return 0; | 1906 | return 0; |
1907 | } | 1907 | } |
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index 792b2e807bf3..ced3eebe252c 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c | |||
@@ -895,7 +895,7 @@ static void inia100_build_scb(struct orc_host * host, struct orc_scb * scb, stru | |||
895 | } else { | 895 | } else { |
896 | scb->tag_msg = 0; /* No tag support */ | 896 | scb->tag_msg = 0; /* No tag support */ |
897 | } | 897 | } |
898 | memcpy(&scb->cdb[0], &cmd->cmnd, scb->cdb_len); | 898 | memcpy(scb->cdb, cmd->cmnd, scb->cdb_len); |
899 | } | 899 | } |
900 | 900 | ||
901 | /** | 901 | /** |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index c6d6e7c6559a..8e2e964af668 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -465,7 +465,7 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | |||
465 | scp->request = (struct request *)&wait; | 465 | scp->request = (struct request *)&wait; |
466 | scp->timeout_per_command = timeout*HZ; | 466 | scp->timeout_per_command = timeout*HZ; |
467 | scp->cmd_len = 12; | 467 | scp->cmd_len = 12; |
468 | memcpy(scp->cmnd, cmnd, 12); | 468 | scp->cmnd = cmnd; |
469 | cmndinfo.priority = IOCTL_PRI; | 469 | cmndinfo.priority = IOCTL_PRI; |
470 | cmndinfo.internal_cmd_str = gdtcmd; | 470 | cmndinfo.internal_cmd_str = gdtcmd; |
471 | cmndinfo.internal_command = 1; | 471 | cmndinfo.internal_command = 1; |
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index 5b7be1e9841c..aaa48e0c8ed0 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c | |||
@@ -763,9 +763,9 @@ static int hptiop_queuecommand(struct scsi_cmnd *scp, | |||
763 | scp, | 763 | scp, |
764 | host->host_no, scp->device->channel, | 764 | host->host_no, scp->device->channel, |
765 | scp->device->id, scp->device->lun, | 765 | scp->device->id, scp->device->lun, |
766 | *((u32 *)&scp->cmnd), | 766 | ((u32 *)scp->cmnd)[0], |
767 | *((u32 *)&scp->cmnd + 1), | 767 | ((u32 *)scp->cmnd)[1], |
768 | *((u32 *)&scp->cmnd + 2), | 768 | ((u32 *)scp->cmnd)[2], |
769 | _req->index, _req->req_virt); | 769 | _req->index, _req->req_virt); |
770 | 770 | ||
771 | scp->result = 0; | 771 | scp->result = 0; |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 9c77015b7a80..ccfd8aca3765 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -739,7 +739,7 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd, | |||
739 | srp_cmd = &evt_struct->iu.srp.cmd; | 739 | srp_cmd = &evt_struct->iu.srp.cmd; |
740 | memset(srp_cmd, 0x00, SRP_MAX_IU_LEN); | 740 | memset(srp_cmd, 0x00, SRP_MAX_IU_LEN); |
741 | srp_cmd->opcode = SRP_CMD; | 741 | srp_cmd->opcode = SRP_CMD; |
742 | memcpy(srp_cmd->cdb, cmnd->cmnd, sizeof(cmnd->cmnd)); | 742 | memcpy(srp_cmd->cdb, cmnd->cmnd, sizeof(srp_cmd->cdb)); |
743 | srp_cmd->lun = ((u64) lun) << 48; | 743 | srp_cmd->lun = ((u64) lun) << 48; |
744 | 744 | ||
745 | if (!map_data_for_srp_cmd(cmnd, evt_struct, srp_cmd, hostdata->dev)) { | 745 | if (!map_data_for_srp_cmd(cmnd, evt_struct, srp_cmd, hostdata->dev)) { |
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index dbae3fdb8506..e3f739776bad 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c | |||
@@ -2590,7 +2590,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c | |||
2590 | cblk->hastat = 0; | 2590 | cblk->hastat = 0; |
2591 | cblk->tastat = 0; | 2591 | cblk->tastat = 0; |
2592 | /* Command the command */ | 2592 | /* Command the command */ |
2593 | memcpy(&cblk->cdb[0], &cmnd->cmnd, cmnd->cmd_len); | 2593 | memcpy(cblk->cdb, cmnd->cmnd, cmnd->cmd_len); |
2594 | 2594 | ||
2595 | /* Set up tags */ | 2595 | /* Set up tags */ |
2596 | if (cmnd->device->tagged_supported) { /* Tag Support */ | 2596 | if (cmnd->device->tagged_supported) { /* Tag Support */ |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 09ab3eac1c1a..fa060932d2b4 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -2858,7 +2858,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
2858 | 2858 | ||
2859 | /* Load SCSI command packet. */ | 2859 | /* Load SCSI command packet. */ |
2860 | pkt->cdb_len = cpu_to_le16(CMD_CDBLEN(cmd)); | 2860 | pkt->cdb_len = cpu_to_le16(CMD_CDBLEN(cmd)); |
2861 | memcpy(pkt->scsi_cdb, &(CMD_CDBP(cmd)), CMD_CDBLEN(cmd)); | 2861 | memcpy(pkt->scsi_cdb, CMD_CDBP(cmd), CMD_CDBLEN(cmd)); |
2862 | /* dprintk(1, "Build packet for command[0]=0x%x\n",pkt->scsi_cdb[0]); */ | 2862 | /* dprintk(1, "Build packet for command[0]=0x%x\n",pkt->scsi_cdb[0]); */ |
2863 | 2863 | ||
2864 | /* Set transfer direction. */ | 2864 | /* Set transfer direction. */ |
@@ -3127,7 +3127,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
3127 | 3127 | ||
3128 | /* Load SCSI command packet. */ | 3128 | /* Load SCSI command packet. */ |
3129 | pkt->cdb_len = cpu_to_le16(CMD_CDBLEN(cmd)); | 3129 | pkt->cdb_len = cpu_to_le16(CMD_CDBLEN(cmd)); |
3130 | memcpy(pkt->scsi_cdb, &(CMD_CDBP(cmd)), CMD_CDBLEN(cmd)); | 3130 | memcpy(pkt->scsi_cdb, CMD_CDBP(cmd), CMD_CDBLEN(cmd)); |
3131 | 3131 | ||
3132 | /*dprintk(1, "Build packet for command[0]=0x%x\n",pkt->scsi_cdb[0]); */ | 3132 | /*dprintk(1, "Build packet for command[0]=0x%x\n",pkt->scsi_cdb[0]); */ |
3133 | /* Set transfer direction. */ | 3133 | /* Set transfer direction. */ |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 221f31e36d26..334244c73955 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -626,7 +626,7 @@ static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) | |||
626 | * @scmd: SCSI command structure to hijack | 626 | * @scmd: SCSI command structure to hijack |
627 | * @ses: structure to save restore information | 627 | * @ses: structure to save restore information |
628 | * @cmnd: CDB to send. Can be NULL if no new cmnd is needed | 628 | * @cmnd: CDB to send. Can be NULL if no new cmnd is needed |
629 | * @cmnd_size: size in bytes of @cmnd | 629 | * @cmnd_size: size in bytes of @cmnd (must be <= BLK_MAX_CDB) |
630 | * @sense_bytes: size of sense data to copy. or 0 (if != 0 @cmnd is ignored) | 630 | * @sense_bytes: size of sense data to copy. or 0 (if != 0 @cmnd is ignored) |
631 | * | 631 | * |
632 | * This function is used to save a scsi command information before re-execution | 632 | * This function is used to save a scsi command information before re-execution |
@@ -648,12 +648,14 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, | |||
648 | * command. | 648 | * command. |
649 | */ | 649 | */ |
650 | ses->cmd_len = scmd->cmd_len; | 650 | ses->cmd_len = scmd->cmd_len; |
651 | memcpy(ses->cmnd, scmd->cmnd, sizeof(scmd->cmnd)); | 651 | ses->cmnd = scmd->cmnd; |
652 | ses->data_direction = scmd->sc_data_direction; | 652 | ses->data_direction = scmd->sc_data_direction; |
653 | ses->sdb = scmd->sdb; | 653 | ses->sdb = scmd->sdb; |
654 | ses->next_rq = scmd->request->next_rq; | 654 | ses->next_rq = scmd->request->next_rq; |
655 | ses->result = scmd->result; | 655 | ses->result = scmd->result; |
656 | 656 | ||
657 | scmd->cmnd = ses->eh_cmnd; | ||
658 | memset(scmd->cmnd, 0, BLK_MAX_CDB); | ||
657 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); | 659 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); |
658 | scmd->request->next_rq = NULL; | 660 | scmd->request->next_rq = NULL; |
659 | 661 | ||
@@ -665,14 +667,13 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, | |||
665 | scmd->sdb.table.sgl = &ses->sense_sgl; | 667 | scmd->sdb.table.sgl = &ses->sense_sgl; |
666 | scmd->sc_data_direction = DMA_FROM_DEVICE; | 668 | scmd->sc_data_direction = DMA_FROM_DEVICE; |
667 | scmd->sdb.table.nents = 1; | 669 | scmd->sdb.table.nents = 1; |
668 | memset(scmd->cmnd, 0, sizeof(scmd->cmnd)); | ||
669 | scmd->cmnd[0] = REQUEST_SENSE; | 670 | scmd->cmnd[0] = REQUEST_SENSE; |
670 | scmd->cmnd[4] = scmd->sdb.length; | 671 | scmd->cmnd[4] = scmd->sdb.length; |
671 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); | 672 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); |
672 | } else { | 673 | } else { |
673 | scmd->sc_data_direction = DMA_NONE; | 674 | scmd->sc_data_direction = DMA_NONE; |
674 | if (cmnd) { | 675 | if (cmnd) { |
675 | memset(scmd->cmnd, 0, sizeof(scmd->cmnd)); | 676 | BUG_ON(cmnd_size > BLK_MAX_CDB); |
676 | memcpy(scmd->cmnd, cmnd, cmnd_size); | 677 | memcpy(scmd->cmnd, cmnd, cmnd_size); |
677 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); | 678 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); |
678 | } | 679 | } |
@@ -705,7 +706,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) | |||
705 | * Restore original data | 706 | * Restore original data |
706 | */ | 707 | */ |
707 | scmd->cmd_len = ses->cmd_len; | 708 | scmd->cmd_len = ses->cmd_len; |
708 | memcpy(scmd->cmnd, ses->cmnd, sizeof(scmd->cmnd)); | 709 | scmd->cmnd = ses->cmnd; |
709 | scmd->sc_data_direction = ses->data_direction; | 710 | scmd->sc_data_direction = ses->data_direction; |
710 | scmd->sdb = ses->sdb; | 711 | scmd->sdb = ses->sdb; |
711 | scmd->request->next_rq = ses->next_rq; | 712 | scmd->request->next_rq = ses->next_rq; |
@@ -1774,8 +1775,8 @@ scsi_reset_provider(struct scsi_device *dev, int flag) | |||
1774 | scmd->request = &req; | 1775 | scmd->request = &req; |
1775 | memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); | 1776 | memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); |
1776 | 1777 | ||
1777 | memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); | 1778 | scmd->cmnd = req.cmd; |
1778 | 1779 | ||
1779 | scmd->scsi_done = scsi_reset_provider_done_command; | 1780 | scmd->scsi_done = scsi_reset_provider_done_command; |
1780 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); | 1781 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); |
1781 | 1782 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 67f412bb4974..325270b520e1 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1090,6 +1090,8 @@ static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev, | |||
1090 | cmd->tag = req->tag; | 1090 | cmd->tag = req->tag; |
1091 | cmd->request = req; | 1091 | cmd->request = req; |
1092 | 1092 | ||
1093 | cmd->cmnd = req->cmd; | ||
1094 | |||
1093 | return cmd; | 1095 | return cmd; |
1094 | } | 1096 | } |
1095 | 1097 | ||
@@ -1127,8 +1129,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | |||
1127 | req->buffer = NULL; | 1129 | req->buffer = NULL; |
1128 | } | 1130 | } |
1129 | 1131 | ||
1130 | BUILD_BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd)); | ||
1131 | memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); | ||
1132 | cmd->cmd_len = req->cmd_len; | 1132 | cmd->cmd_len = req->cmd_len; |
1133 | if (!req->data_len) | 1133 | if (!req->data_len) |
1134 | cmd->sc_data_direction = DMA_NONE; | 1134 | cmd->sc_data_direction = DMA_NONE; |
@@ -1165,6 +1165,7 @@ int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req) | |||
1165 | if (unlikely(!cmd)) | 1165 | if (unlikely(!cmd)) |
1166 | return BLKPREP_DEFER; | 1166 | return BLKPREP_DEFER; |
1167 | 1167 | ||
1168 | memset(cmd->cmnd, 0, BLK_MAX_CDB); | ||
1168 | return scsi_init_io(cmd, GFP_ATOMIC); | 1169 | return scsi_init_io(cmd, GFP_ATOMIC); |
1169 | } | 1170 | } |
1170 | EXPORT_SYMBOL(scsi_setup_fs_cmnd); | 1171 | EXPORT_SYMBOL(scsi_setup_fs_cmnd); |
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index ee8496aa0336..257e097c39af 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c | |||
@@ -107,6 +107,8 @@ struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *shost, | |||
107 | cmd->jiffies_at_alloc = jiffies; | 107 | cmd->jiffies_at_alloc = jiffies; |
108 | cmd->request = rq; | 108 | cmd->request = rq; |
109 | 109 | ||
110 | cmd->cmnd = rq->cmd; | ||
111 | |||
110 | rq->special = cmd; | 112 | rq->special = cmd; |
111 | rq->cmd_type = REQ_TYPE_SPECIAL; | 113 | rq->cmd_type = REQ_TYPE_SPECIAL; |
112 | rq->cmd_flags |= REQ_TYPE_BLOCK_PC; | 114 | rq->cmd_flags |= REQ_TYPE_BLOCK_PC; |
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c index d88824b3511c..898e67d30e56 100644 --- a/drivers/usb/storage/cypress_atacb.c +++ b/drivers/usb/storage/cypress_atacb.c | |||
@@ -46,7 +46,7 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) | |||
46 | } | 46 | } |
47 | 47 | ||
48 | memcpy(save_cmnd, srb->cmnd, sizeof(save_cmnd)); | 48 | memcpy(save_cmnd, srb->cmnd, sizeof(save_cmnd)); |
49 | memset(srb->cmnd, 0, sizeof(srb->cmnd)); | 49 | memset(srb->cmnd, 0, MAX_COMMAND_SIZE); |
50 | 50 | ||
51 | /* check if we support the command */ | 51 | /* check if we support the command */ |
52 | if (save_cmnd[1] >> 5) /* MULTIPLE_COUNT */ | 52 | if (save_cmnd[1] >> 5) /* MULTIPLE_COUNT */ |
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 971d13dd5e65..3addcd8f827b 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -292,6 +292,7 @@ struct isd200_info { | |||
292 | 292 | ||
293 | /* maximum number of LUNs supported */ | 293 | /* maximum number of LUNs supported */ |
294 | unsigned char MaxLUNs; | 294 | unsigned char MaxLUNs; |
295 | unsigned char cmnd[BLK_MAX_CDB]; | ||
295 | struct scsi_cmnd srb; | 296 | struct scsi_cmnd srb; |
296 | struct scatterlist sg; | 297 | struct scatterlist sg; |
297 | }; | 298 | }; |
@@ -450,6 +451,7 @@ static int isd200_action( struct us_data *us, int action, | |||
450 | 451 | ||
451 | memset(&ata, 0, sizeof(ata)); | 452 | memset(&ata, 0, sizeof(ata)); |
452 | memset(&srb_dev, 0, sizeof(srb_dev)); | 453 | memset(&srb_dev, 0, sizeof(srb_dev)); |
454 | srb->cmnd = info->cmnd; | ||
453 | srb->device = &srb_dev; | 455 | srb->device = &srb_dev; |
454 | ++srb->serial_number; | 456 | ++srb->serial_number; |
455 | 457 | ||