RE: [PATCH v3 09/26] compat_ioctl: move drivers to compat_ptr_ioctl
> > On Tue, Apr 16, 2019 at 10:19:47PM +0200, Arnd Bergmann wrote: > > Each of these drivers has a copy of the same trivial helper function > > to convert the pointer argument and then call the native ioctl handler. > > > > We now have a generic implementation of that, so use it. > > > > Acked-by: Greg Kroah-Hartman > > Reviewed-by: Jarkko Sakkinen > > Reviewed-by: Jason Gunthorpe > > Signed-off-by: Arnd Bergmann > > Acked-by: Michael S. Tsirkin Acked-by: Tomas Winkler > > > --- > > drivers/char/ppdev.c | 12 +- > > drivers/char/tpm/tpm_vtpm_proxy.c | 12 +- > > drivers/firewire/core-cdev.c | 12 +- > > drivers/hid/usbhid/hiddev.c | 11 + > > drivers/hwtracing/stm/core.c | 12 +- > > drivers/misc/mei/main.c | 22 + > > drivers/mtd/ubi/cdev.c| 36 +++- > > drivers/net/tap.c | 12 +- > > drivers/staging/pi433/pi433_if.c | 12 +- > > drivers/usb/core/devio.c | 16 + > > drivers/vfio/vfio.c | 39 +++ > > drivers/vhost/net.c | 12 +- > > drivers/vhost/scsi.c | 12 +- > > drivers/vhost/test.c | 12 +- > > drivers/vhost/vsock.c | 12 +- > > fs/fat/file.c | 13 +-- > > 16 files changed, 20 insertions(+), 237 deletions(-) > > > > diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index > > 1ae77b41050a..e96c8d9623e0 100644 > > --- a/drivers/char/ppdev.c > > +++ b/drivers/char/ppdev.c > > @@ -674,14 +674,6 @@ static long pp_ioctl(struct file *file, unsigned int > cmd, unsigned long arg) > > return ret; > > } > > > > -#ifdef CONFIG_COMPAT > > -static long pp_compat_ioctl(struct file *file, unsigned int cmd, > > - unsigned long arg) > > -{ > > - return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); > > -} > > -#endif > > - > > static int pp_open(struct inode *inode, struct file *file) { > > unsigned int minor = iminor(inode); > > @@ -790,9 +782,7 @@ static const struct file_operations pp_fops = { > > .write = pp_write, > > .poll = pp_poll, > > .unlocked_ioctl = pp_ioctl, > > -#ifdef CONFIG_COMPAT > > - .compat_ioctl = pp_compat_ioctl, > > -#endif > > + .compat_ioctl = compat_ptr_ioctl, > > .open = pp_open, > > .release= pp_release, > > }; > > diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c > > b/drivers/char/tpm/tpm_vtpm_proxy.c > > index d74f3de74ae6..fb845f0a430b 100644 > > --- a/drivers/char/tpm/tpm_vtpm_proxy.c > > +++ b/drivers/char/tpm/tpm_vtpm_proxy.c > > @@ -675,20 +675,10 @@ static long vtpmx_fops_ioctl(struct file *f, unsigned > int ioctl, > > } > > } > > > > -#ifdef CONFIG_COMPAT > > -static long vtpmx_fops_compat_ioctl(struct file *f, unsigned int ioctl, > > - unsigned long arg) > > -{ > > - return vtpmx_fops_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); > > -} > > -#endif > > - > > static const struct file_operations vtpmx_fops = { > > .owner = THIS_MODULE, > > .unlocked_ioctl = vtpmx_fops_ioctl, > > -#ifdef CONFIG_COMPAT > > - .compat_ioctl = vtpmx_fops_compat_ioctl, > > -#endif > > + .compat_ioctl = compat_ptr_ioctl, > > .llseek = noop_llseek, > > }; > > > > diff --git a/drivers/firewire/core-cdev.c > > b/drivers/firewire/core-cdev.c index 16a7045736a9..fb934680fdd3 100644 > > --- a/drivers/firewire/core-cdev.c > > +++ b/drivers/firewire/core-cdev.c > > @@ -1659,14 +1659,6 @@ static long fw_device_op_ioctl(struct file *file, > > return dispatch_ioctl(file->private_data, cmd, (void __user *)arg); > > } > > > > -#ifdef CONFIG_COMPAT > > -static long fw_device_op_compat_ioctl(struct file *file, > > - unsigned int cmd, unsigned long arg) > > -{ > > - return dispatch_ioctl(file->private_data, cmd, compat_ptr(arg)); > > -} > > -#endif > > - > > static int fw_device_op_mmap(struct file *file, struct vm_area_struct > > *vma) { > > struct client *client = file->private_data; @@ -1808,7 +1800,5 @@ > > const struct file_operations fw_device_ops = { > > .mmap = fw_device_op_mmap, > > .release= fw_device_op_release, > > .poll = fw_device_op_poll, > > -#ifdef CONFIG_COMPAT > > - .compat_ioctl = fw_device_op_compat_ioctl, > > -#endif > > + .compat_ioctl = compat_ptr_ioctl, > > }; > > diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c > > index a746017fac17..ef4a1cd389d6 100644 > > --- a/drivers/hid/usbhid/hiddev.c > > +++ b/drivers/hid/usbhid/hiddev.c > > @@ -855,13 +855,6 @@ static long hiddev_ioctl(struct file *file, unsigned > > int > cmd, unsigned long arg) > > return r; > > } > > > > -#ifdef CONFIG_COMPAT > > -static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, >
Re: [PATCH v3 09/26] compat_ioctl: move drivers to compat_ptr_ioctl
On Tue, Apr 16, 2019 at 10:19:47PM +0200, Arnd Bergmann wrote: > Each of these drivers has a copy of the same trivial helper function to > convert the pointer argument and then call the native ioctl handler. > > We now have a generic implementation of that, so use it. > > Acked-by: Greg Kroah-Hartman > Reviewed-by: Jarkko Sakkinen > Reviewed-by: Jason Gunthorpe > Signed-off-by: Arnd Bergmann Acked-by: Michael S. Tsirkin > --- > drivers/char/ppdev.c | 12 +- > drivers/char/tpm/tpm_vtpm_proxy.c | 12 +- > drivers/firewire/core-cdev.c | 12 +- > drivers/hid/usbhid/hiddev.c | 11 + > drivers/hwtracing/stm/core.c | 12 +- > drivers/misc/mei/main.c | 22 + > drivers/mtd/ubi/cdev.c| 36 +++- > drivers/net/tap.c | 12 +- > drivers/staging/pi433/pi433_if.c | 12 +- > drivers/usb/core/devio.c | 16 + > drivers/vfio/vfio.c | 39 +++ > drivers/vhost/net.c | 12 +- > drivers/vhost/scsi.c | 12 +- > drivers/vhost/test.c | 12 +- > drivers/vhost/vsock.c | 12 +- > fs/fat/file.c | 13 +-- > 16 files changed, 20 insertions(+), 237 deletions(-) > > diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c > index 1ae77b41050a..e96c8d9623e0 100644 > --- a/drivers/char/ppdev.c > +++ b/drivers/char/ppdev.c > @@ -674,14 +674,6 @@ static long pp_ioctl(struct file *file, unsigned int > cmd, unsigned long arg) > return ret; > } > > -#ifdef CONFIG_COMPAT > -static long pp_compat_ioctl(struct file *file, unsigned int cmd, > - unsigned long arg) > -{ > - return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); > -} > -#endif > - > static int pp_open(struct inode *inode, struct file *file) > { > unsigned int minor = iminor(inode); > @@ -790,9 +782,7 @@ static const struct file_operations pp_fops = { > .write = pp_write, > .poll = pp_poll, > .unlocked_ioctl = pp_ioctl, > -#ifdef CONFIG_COMPAT > - .compat_ioctl = pp_compat_ioctl, > -#endif > + .compat_ioctl = compat_ptr_ioctl, > .open = pp_open, > .release= pp_release, > }; > diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c > b/drivers/char/tpm/tpm_vtpm_proxy.c > index d74f3de74ae6..fb845f0a430b 100644 > --- a/drivers/char/tpm/tpm_vtpm_proxy.c > +++ b/drivers/char/tpm/tpm_vtpm_proxy.c > @@ -675,20 +675,10 @@ static long vtpmx_fops_ioctl(struct file *f, unsigned > int ioctl, > } > } > > -#ifdef CONFIG_COMPAT > -static long vtpmx_fops_compat_ioctl(struct file *f, unsigned int ioctl, > - unsigned long arg) > -{ > - return vtpmx_fops_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); > -} > -#endif > - > static const struct file_operations vtpmx_fops = { > .owner = THIS_MODULE, > .unlocked_ioctl = vtpmx_fops_ioctl, > -#ifdef CONFIG_COMPAT > - .compat_ioctl = vtpmx_fops_compat_ioctl, > -#endif > + .compat_ioctl = compat_ptr_ioctl, > .llseek = noop_llseek, > }; > > diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c > index 16a7045736a9..fb934680fdd3 100644 > --- a/drivers/firewire/core-cdev.c > +++ b/drivers/firewire/core-cdev.c > @@ -1659,14 +1659,6 @@ static long fw_device_op_ioctl(struct file *file, > return dispatch_ioctl(file->private_data, cmd, (void __user *)arg); > } > > -#ifdef CONFIG_COMPAT > -static long fw_device_op_compat_ioctl(struct file *file, > - unsigned int cmd, unsigned long arg) > -{ > - return dispatch_ioctl(file->private_data, cmd, compat_ptr(arg)); > -} > -#endif > - > static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) > { > struct client *client = file->private_data; > @@ -1808,7 +1800,5 @@ const struct file_operations fw_device_ops = { > .mmap = fw_device_op_mmap, > .release= fw_device_op_release, > .poll = fw_device_op_poll, > -#ifdef CONFIG_COMPAT > - .compat_ioctl = fw_device_op_compat_ioctl, > -#endif > + .compat_ioctl = compat_ptr_ioctl, > }; > diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c > index a746017fac17..ef4a1cd389d6 100644 > --- a/drivers/hid/usbhid/hiddev.c > +++ b/drivers/hid/usbhid/hiddev.c > @@ -855,13 +855,6 @@ static long hiddev_ioctl(struct file *file, unsigned int > cmd, unsigned long arg) > return r; > } > > -#ifdef CONFIG_COMPAT > -static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, > unsigned long arg) > -{ > - return hiddev_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); > -} > -#endif > - > static const struct file_operations hiddev_fops = { > .owner =THIS_MODULE,
Re: [PATCH v3 09/26] compat_ioctl: move drivers to compat_ptr_ioctl
On Tue, Apr 16, 2019 at 10:19:47PM +0200, Arnd Bergmann wrote: > Each of these drivers has a copy of the same trivial helper function to > convert the pointer argument and then call the native ioctl handler. > > We now have a generic implementation of that, so use it. > > Acked-by: Greg Kroah-Hartman > Reviewed-by: Jarkko Sakkinen > Reviewed-by: Jason Gunthorpe > Signed-off-by: Arnd Bergmann > --- > drivers/char/ppdev.c | 12 +- > drivers/char/tpm/tpm_vtpm_proxy.c | 12 +- > drivers/firewire/core-cdev.c | 12 +- > drivers/hid/usbhid/hiddev.c | 11 + > drivers/hwtracing/stm/core.c | 12 +- > drivers/misc/mei/main.c | 22 + > drivers/mtd/ubi/cdev.c| 36 +++- > drivers/net/tap.c | 12 +- > drivers/staging/pi433/pi433_if.c | 12 +- > drivers/usb/core/devio.c | 16 + > drivers/vfio/vfio.c | 39 +++ > drivers/vhost/net.c | 12 +- > drivers/vhost/scsi.c | 12 +- > drivers/vhost/test.c | 12 +- > drivers/vhost/vsock.c | 12 +- > fs/fat/file.c | 13 +-- > 16 files changed, 20 insertions(+), 237 deletions(-) The vhost parts look good: Reviewed-by: Stefan Hajnoczi signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 09/26] compat_ioctl: move drivers to compat_ptr_ioctl
On Tue, 16 Apr 2019, Arnd Bergmann wrote: > Each of these drivers has a copy of the same trivial helper function to > convert the pointer argument and then call the native ioctl handler. > > We now have a generic implementation of that, so use it. > > Acked-by: Greg Kroah-Hartman > Reviewed-by: Jarkko Sakkinen > Reviewed-by: Jason Gunthorpe > Signed-off-by: Arnd Bergmann > --- > drivers/char/ppdev.c | 12 +- > drivers/char/tpm/tpm_vtpm_proxy.c | 12 +- > drivers/firewire/core-cdev.c | 12 +- > drivers/hid/usbhid/hiddev.c | 11 + For hiddev.c: Reviewed-by: Jiri Kosina -- Jiri Kosina SUSE Labs ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 09/26] compat_ioctl: move drivers to compat_ptr_ioctl
Each of these drivers has a copy of the same trivial helper function to convert the pointer argument and then call the native ioctl handler. We now have a generic implementation of that, so use it. Acked-by: Greg Kroah-Hartman Reviewed-by: Jarkko Sakkinen Reviewed-by: Jason Gunthorpe Signed-off-by: Arnd Bergmann --- drivers/char/ppdev.c | 12 +- drivers/char/tpm/tpm_vtpm_proxy.c | 12 +- drivers/firewire/core-cdev.c | 12 +- drivers/hid/usbhid/hiddev.c | 11 + drivers/hwtracing/stm/core.c | 12 +- drivers/misc/mei/main.c | 22 + drivers/mtd/ubi/cdev.c| 36 +++- drivers/net/tap.c | 12 +- drivers/staging/pi433/pi433_if.c | 12 +- drivers/usb/core/devio.c | 16 + drivers/vfio/vfio.c | 39 +++ drivers/vhost/net.c | 12 +- drivers/vhost/scsi.c | 12 +- drivers/vhost/test.c | 12 +- drivers/vhost/vsock.c | 12 +- fs/fat/file.c | 13 +-- 16 files changed, 20 insertions(+), 237 deletions(-) diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 1ae77b41050a..e96c8d9623e0 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -674,14 +674,6 @@ static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return ret; } -#ifdef CONFIG_COMPAT -static long pp_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static int pp_open(struct inode *inode, struct file *file) { unsigned int minor = iminor(inode); @@ -790,9 +782,7 @@ static const struct file_operations pp_fops = { .write = pp_write, .poll = pp_poll, .unlocked_ioctl = pp_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = pp_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = pp_open, .release= pp_release, }; diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c index d74f3de74ae6..fb845f0a430b 100644 --- a/drivers/char/tpm/tpm_vtpm_proxy.c +++ b/drivers/char/tpm/tpm_vtpm_proxy.c @@ -675,20 +675,10 @@ static long vtpmx_fops_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vtpmx_fops_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vtpmx_fops_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vtpmx_fops = { .owner = THIS_MODULE, .unlocked_ioctl = vtpmx_fops_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vtpmx_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 16a7045736a9..fb934680fdd3 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -1659,14 +1659,6 @@ static long fw_device_op_ioctl(struct file *file, return dispatch_ioctl(file->private_data, cmd, (void __user *)arg); } -#ifdef CONFIG_COMPAT -static long fw_device_op_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -{ - return dispatch_ioctl(file->private_data, cmd, compat_ptr(arg)); -} -#endif - static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) { struct client *client = file->private_data; @@ -1808,7 +1800,5 @@ const struct file_operations fw_device_ops = { .mmap = fw_device_op_mmap, .release= fw_device_op_release, .poll = fw_device_op_poll, -#ifdef CONFIG_COMPAT - .compat_ioctl = fw_device_op_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index a746017fac17..ef4a1cd389d6 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -855,13 +855,6 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return r; } -#ifdef CONFIG_COMPAT -static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - return hiddev_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations hiddev_fops = { .owner =THIS_MODULE, .read = hiddev_read, @@ -871,9 +864,7 @@ static const struct file_operations hiddev_fops = { .release = hiddev_release, .unlocked_ioctl = hiddev_ioctl, .fasync = hiddev_fasync, -#ifdef CONFIG_COMPAT - .compat_ioctl =