fix warnings in new compat code for scsi
Subsystems (3)
PATCH 1/1 fix warnings in new compat code for scsi
I just got around to applying and testing this. I needed the attached to get around the compile warnings it gave me on ia64
I've got to say, it doesn't look pretty to have the block layer compat_ioctl returning long but the scsi one returning int; likewise with the void __user *arg vs unsigned long arg.
James
===== drivers/scsi/osst.c 1.68 vs edited =====
drivers/scsi/osst.c +1 -1
@@ -5129,7 +5129,7 @@int ret = -ENOIOCTLCMD ;if (sdev->host->hostt->compat_ioctl) { - ret = sdev->host->hostt->compat_ioctl (sdev, cmd_in, arg); + ret = sdev->host->hostt->compat_ioctl (sdev, cmd_in, (void __user *)arg); }return ret;
===== drivers/scsi/st.c 1.99 vs edited =====
drivers/scsi/st.c +2 -2
@@ -3427,14 +3427,14 @@ }#ifdef CONFIG_COMPAT -static int st_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +static long st_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct scsi_tape *STp = file->private_data;struct scsi_device *sdev = STp->device;int ret = -ENOIOCTLCMD ;if (sdev->host->hostt->compat_ioctl) { - ret = sdev->host->hostt->compat_ioctl (sdev, cmd, arg); + ret = sdev->host->hostt->compat_ioctl (sdev, cmd, (void __user *)arg); }return ret;
===== drivers/scsi/aacraid/linit.c 1.45 vs edited =====
drivers/scsi/aacraid/linit.c +2 -2
@@ -514,10 +514,10 @@return ret; } -static long aac_compat_ioctl (struct scsi_device *sdev,int cmd,void __user *arg) +static int aac_compat_ioctl (struct scsi_device *sdev,int cmd,void __user *arg) {struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; -return aac_compat_do_ioctl (dev, cmd, arg); +return aac_compat_do_ioctl (dev, cmd, (unsigned long )arg); }static long aac_compat_cfg_ioctl (struct file *file,unsigned cmd,unsigned long arg)
Quoted 6 lines · James Bottomley
I just got around to applying and testing this. I needed the attached to get around the compile warnings it gave me on ia64
I've got to say, it doesn't look pretty to have the block layer
compat_ioctlreturning long but the scsi one returning int; likewise with the void__user*arg vs unsigned long arg.
Seconded. Use of long is utter idiocy:
a) ioctl(2) is declared as int in userland headers b) ->ioctl() returns int c) ->compat_ioctl() is supposed to emulate ->ioctl() of 32bit
platform, for fsck sake! Even if none of the above would apply, it would _still_ be 32bit.
And the first two reasons apply to ->unlocked_ioctl() as well. Could we please undo that bright decision until it's too late? I can do patches for that in by tomorrow morning...