Commit a656d47a authored by Al Viro's avatar Al Viro

scsi_ioctl.c: switch SCSI_IOCTL_GET_IDLUN to copy_to_user()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent ce5155c4
...@@ -211,18 +211,18 @@ static int scsi_ioctl_common(struct scsi_device *sdev, int cmd, void __user *arg ...@@ -211,18 +211,18 @@ static int scsi_ioctl_common(struct scsi_device *sdev, int cmd, void __user *arg
} }
switch (cmd) { switch (cmd) {
case SCSI_IOCTL_GET_IDLUN: case SCSI_IOCTL_GET_IDLUN: {
if (!access_ok(arg, sizeof(struct scsi_idlun))) struct scsi_idlun v = {
return -EFAULT; .dev_id = (sdev->id & 0xff)
__put_user((sdev->id & 0xff)
+ ((sdev->lun & 0xff) << 8) + ((sdev->lun & 0xff) << 8)
+ ((sdev->channel & 0xff) << 16) + ((sdev->channel & 0xff) << 16)
+ ((sdev->host->host_no & 0xff) << 24), + ((sdev->host->host_no & 0xff) << 24),
&((struct scsi_idlun __user *)arg)->dev_id); .host_unique_id = sdev->host->unique_id
__put_user(sdev->host->unique_id, };
&((struct scsi_idlun __user *)arg)->host_unique_id); if (copy_to_user(arg, &v, sizeof(struct scsi_idlun)))
return -EFAULT;
return 0; return 0;
}
case SCSI_IOCTL_GET_BUS_NUMBER: case SCSI_IOCTL_GET_BUS_NUMBER:
return put_user(sdev->host->host_no, (int __user *)arg); return put_user(sdev->host->host_no, (int __user *)arg);
case SCSI_IOCTL_PROBE_HOST: case SCSI_IOCTL_PROBE_HOST:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment