aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libiscsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r--drivers/scsi/libiscsi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 5e6a42429c39..eb5113607958 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -120,7 +120,9 @@ static void iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
120 session->cmdsn++; 120 session->cmdsn++;
121 hdr->exp_statsn = cpu_to_be32(conn->exp_statsn); 121 hdr->exp_statsn = cpu_to_be32(conn->exp_statsn);
122 memcpy(hdr->cdb, sc->cmnd, sc->cmd_len); 122 memcpy(hdr->cdb, sc->cmnd, sc->cmd_len);
123 memset(&hdr->cdb[sc->cmd_len], 0, MAX_COMMAND_SIZE - sc->cmd_len); 123 if (sc->cmd_len < MAX_COMMAND_SIZE)
124 memset(&hdr->cdb[sc->cmd_len], 0,
125 MAX_COMMAND_SIZE - sc->cmd_len);
124 126
125 ctask->data_count = 0; 127 ctask->data_count = 0;
126 if (sc->sc_data_direction == DMA_TO_DEVICE) { 128 if (sc->sc_data_direction == DMA_TO_DEVICE) {
@@ -165,7 +167,6 @@ static void iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
165 /* No unsolicit Data-Out's */ 167 /* No unsolicit Data-Out's */
166 ctask->hdr->flags |= ISCSI_FLAG_CMD_FINAL; 168 ctask->hdr->flags |= ISCSI_FLAG_CMD_FINAL;
167 } else { 169 } else {
168 ctask->datasn = 0;
169 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 170 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
170 zero_data(hdr->dlength); 171 zero_data(hdr->dlength);
171 172