staging: lustre: uapi: remove obd_ioctl_popdata() wrapper
authorJames Simmons <jsimmons@infradead.org>
Sun, 20 Aug 2017 02:26:03 +0000 (22:26 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Aug 2017 01:36:47 +0000 (18:36 -0700)
Replace obd_ioctl_popdata() with direct copy_to_user() call.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6401
Reviewed-on: https://review.whamcloud.com/24568
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lustre/lustre_ioctl.h
drivers/staging/lustre/lustre/obdclass/class_obd.c
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c

index 7a61a0084d5f95e231ec90d2c330e41755bdf510..da9a07115b3715b6c4d3820d595175a13360a2cd 100644 (file)
@@ -209,7 +209,6 @@ static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
 }
 
 int obd_ioctl_getdata(char **buf, int *len, void __user *arg);
-int obd_ioctl_popdata(void __user *arg, void *data, int len);
 
 /*
  * OBD_IOC_DATA_TYPE is only for compatibility reasons with older
index 8cc1fdcfcf777d97aa21a007ee48bb5d26f33d52..477d611a92b084761df5e7633c13476f332ffe5c 100644 (file)
@@ -206,8 +206,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                memcpy(data->ioc_bulk, LUSTRE_VERSION_STRING,
                       strlen(LUSTRE_VERSION_STRING) + 1);
 
-               err = obd_ioctl_popdata((void __user *)arg, data, len);
-               if (err)
+               if (copy_to_user((void __user *)arg, data, len))
                        err = -EFAULT;
                goto out;
 
@@ -225,9 +224,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                        goto out;
                }
 
-               err = obd_ioctl_popdata((void __user *)arg, data,
-                                       sizeof(*data));
-               if (err)
+               if (copy_to_user((void __user *)arg, data, sizeof(*data)))
                        err = -EFAULT;
                goto out;
        }
@@ -263,8 +260,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
 
                CDEBUG(D_IOCTL, "device name %s, dev %d\n", data->ioc_inlbuf1,
                       dev);
-               err = obd_ioctl_popdata((void __user *)arg, data,
-                                       sizeof(*data));
+
+               if (copy_to_user((void __user *)arg, data, sizeof(*data)))
                if (err)
                        err = -EFAULT;
                goto out;
@@ -304,9 +301,9 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                         (int)index, status, obd->obd_type->typ_name,
                         obd->obd_name, obd->obd_uuid.uuid,
                         atomic_read(&obd->obd_refcount));
-               err = obd_ioctl_popdata((void __user *)arg, data, len);
 
-               err = 0;
+               if (copy_to_user((void __user *)arg, data, len))
+                       err = -EFAULT;
                goto out;
        }
        }
@@ -361,8 +358,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                if (err)
                        goto out;
 
-               err = obd_ioctl_popdata((void __user *)arg, data, len);
-               if (err)
+               if (copy_to_user((void __user *)arg, data, len))
                        err = -EFAULT;
                goto out;
        }
index eb88bd9c9b5e7880aec8669d04545a3f1c44bdc8..3a394d21a6f4b33116ccdfe5c1487b35e56e54ca 100644 (file)
@@ -151,14 +151,6 @@ free_buf:
 }
 EXPORT_SYMBOL(obd_ioctl_getdata);
 
-int obd_ioctl_popdata(void __user *arg, void *data, int len)
-{
-       int err;
-
-       err = copy_to_user(arg, data, len) ? -EFAULT : 0;
-       return err;
-}
-
 /*  opening /dev/obd */
 static int obd_class_open(struct inode *inode, struct file *file)
 {