diff options
Diffstat (limited to 'drivers/scsi/scsi_ioctl.c')
-rw-r--r-- | drivers/scsi/scsi_ioctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 26f5bc6d9c82..0bba7d8eebb0 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c | |||
@@ -278,7 +278,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev, | |||
278 | * Obtain the data to be sent to the device (if any). | 278 | * Obtain the data to be sent to the device (if any). |
279 | */ | 279 | */ |
280 | 280 | ||
281 | if(copy_from_user(buf, cmd_in + cmdlen, inlen)) | 281 | if(inlen && copy_from_user(buf, cmd_in + cmdlen, inlen)) |
282 | goto error; | 282 | goto error; |
283 | 283 | ||
284 | switch (opcode) { | 284 | switch (opcode) { |
@@ -322,7 +322,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev, | |||
322 | if (copy_to_user(cmd_in, sense, sb_len)) | 322 | if (copy_to_user(cmd_in, sense, sb_len)) |
323 | result = -EFAULT; | 323 | result = -EFAULT; |
324 | } else { | 324 | } else { |
325 | if (copy_to_user(cmd_in, buf, outlen)) | 325 | if (outlen && copy_to_user(cmd_in, buf, outlen)) |
326 | result = -EFAULT; | 326 | result = -EFAULT; |
327 | } | 327 | } |
328 | 328 | ||