diff options
Diffstat (limited to 'drivers/scsi')
-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 |
10 files changed, 25 insertions, 21 deletions
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; |