diff options
Diffstat (limited to 'block/scsi_ioctl.c')
-rw-r--r-- | block/scsi_ioctl.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index ac63964b7242..dcd9c71fe8d3 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -246,10 +246,10 @@ static int sg_io(struct file *file, request_queue_t *q, | |||
246 | switch (hdr->dxfer_direction) { | 246 | switch (hdr->dxfer_direction) { |
247 | default: | 247 | default: |
248 | return -EINVAL; | 248 | return -EINVAL; |
249 | case SG_DXFER_TO_FROM_DEV: | ||
250 | case SG_DXFER_TO_DEV: | 249 | case SG_DXFER_TO_DEV: |
251 | writing = 1; | 250 | writing = 1; |
252 | break; | 251 | break; |
252 | case SG_DXFER_TO_FROM_DEV: | ||
253 | case SG_DXFER_FROM_DEV: | 253 | case SG_DXFER_FROM_DEV: |
254 | break; | 254 | break; |
255 | } | 255 | } |
@@ -286,9 +286,8 @@ static int sg_io(struct file *file, request_queue_t *q, | |||
286 | * fill in request structure | 286 | * fill in request structure |
287 | */ | 287 | */ |
288 | rq->cmd_len = hdr->cmd_len; | 288 | rq->cmd_len = hdr->cmd_len; |
289 | memset(rq->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */ | ||
289 | memcpy(rq->cmd, cmd, hdr->cmd_len); | 290 | memcpy(rq->cmd, cmd, hdr->cmd_len); |
290 | if (sizeof(rq->cmd) != hdr->cmd_len) | ||
291 | memset(rq->cmd + hdr->cmd_len, 0, sizeof(rq->cmd) - hdr->cmd_len); | ||
292 | 291 | ||
293 | memset(sense, 0, sizeof(sense)); | 292 | memset(sense, 0, sizeof(sense)); |
294 | rq->sense = sense; | 293 | rq->sense = sense; |