Whamcloud - gitweb
LU-5396 obd: add sparse annotation __user wherever needed 21/11821/2
authorfrank zago <frank@zago.net>
Fri, 29 Aug 2014 23:49:15 +0000 (18:49 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 26 Sep 2014 23:15:31 +0000 (23:15 +0000)
This fixes sparse warnings such as:

  .../api-ni.c:1639:33: warning: incorrect type in argument 3
                             (different address spaces)
  .../api-ni.c:1639:33:    expected struct lnet_process_id_t
                             [noderef] [usertype] <asn:1>*ids
  .../api-ni.c:1639:33:    got struct lnet_process_id_t
                             [usertype] *<noident>

There is no code change.

Change-Id: I9040163eedf5ee89be58d78aa7c8d374ed22b981
Signed-off-by: frank zago <fzago@cray.com>
Reviewed-on: http://review.whamcloud.com/11821
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre_ioctl.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/obdclass/class_obd.c
lustre/obdclass/linux/linux-module.c
lustre/obdecho/echo_client.c

index 5263e2d..8dbfc8f 100644 (file)
@@ -202,8 +202,8 @@ static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
 
 #ifdef __KERNEL__
 
-int obd_ioctl_getdata(char **buf, int *len, void *arg);
-int obd_ioctl_popdata(void *arg, void *data, int len);
+int obd_ioctl_getdata(char **buf, int *len, void __user *arg);
+int obd_ioctl_popdata(void __user *arg, void *data, int len);
 
 static inline void obd_ioctl_freedata(char *buf, size_t len)
 {
index b05c726..d28701d 100644 (file)
@@ -878,7 +878,7 @@ struct md_enqueue_info {
 struct obd_ops {
        struct module *o_owner;
        int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
-                          void *karg, void *uarg);
+                          void *karg, void __user *uarg);
         int (*o_get_info)(const struct lu_env *env, struct obd_export *,
                           __u32 keylen, void *key, __u32 *vallen, void *val,
                           struct lov_stripe_md *lsm);
index 71269f6..60cfae5 100644 (file)
@@ -1260,7 +1260,7 @@ static inline int obd_commitrw(const struct lu_env *env, int cmd,
 }
 
 static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
-                                int len, void *karg, void *uarg)
+                               int len, void *karg, void __user *uarg)
 {
         int rc;
         ENTRY;
index 0f35a6b..addd5e5 100644 (file)
@@ -237,7 +237,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
         }
 
         CDEBUG(D_IOCTL, "cmd = %x\n", cmd);
-        if (obd_ioctl_getdata(&buf, &len, (void *)arg)) {
+       if (obd_ioctl_getdata(&buf, &len, (void __user *)arg)) {
                 CERROR("OBD ioctl: data error\n");
                 RETURN(-EINVAL);
         }
@@ -279,7 +279,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                 memcpy(data->ioc_bulk, BUILD_VERSION,
                        strlen(BUILD_VERSION) + 1);
 
-                err = obd_ioctl_popdata((void *)arg, data, len);
+               err = obd_ioctl_popdata((void __user *)arg, data, len);
                 if (err)
                         err = -EFAULT;
                 GOTO(out, err);
@@ -296,7 +296,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                 if (dev < 0)
                         GOTO(out, err = -EINVAL);
 
-                err = obd_ioctl_popdata((void *)arg, data, sizeof(*data));
+               err = obd_ioctl_popdata((void __user *)arg, data,
+                                       sizeof(*data));
                 if (err)
                         err = -EFAULT;
                 GOTO(out, err);
@@ -330,7 +331,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 *)arg, data, sizeof(*data));
+               err = obd_ioctl_popdata((void __user *)arg, data,
+                                       sizeof(*data));
                 if (err)
                         err = -EFAULT;
                 GOTO(out, err);
@@ -366,7 +368,7 @@ 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 *)arg, data, len);
+               err = obd_ioctl_popdata((void __user *)arg, data, len);
 
                 GOTO(out, err = 0);
         }
@@ -414,7 +416,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                 if (err)
                         GOTO(out, err);
 
-                err = obd_ioctl_popdata((void *)arg, data, len);
+               err = obd_ioctl_popdata((void __user *)arg, data, len);
                 if (err)
                         err = -EFAULT;
                 GOTO(out, err);
index 56ee26c..b8b86de 100644 (file)
@@ -78,7 +78,7 @@
 int proc_version;
 
 /* buffer MUST be at least the size of obd_ioctl_hdr */
-int obd_ioctl_getdata(char **buf, int *len, void *arg)
+int obd_ioctl_getdata(char **buf, int *len, void __user *arg)
 {
         struct obd_ioctl_hdr hdr;
         struct obd_ioctl_data *data;
@@ -86,7 +86,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
         int offset = 0;
         ENTRY;
 
-       err = copy_from_user(&hdr, (void *)arg, sizeof(hdr));
+       err = copy_from_user(&hdr, arg, sizeof(hdr));
         if ( err )
                 RETURN(err);
 
@@ -120,7 +120,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
         *len = hdr.ioc_len;
         data = (struct obd_ioctl_data *)*buf;
 
-       err = copy_from_user(*buf, (void *)arg, hdr.ioc_len);
+       err = copy_from_user(*buf, arg, hdr.ioc_len);
         if ( err ) {
                 OBD_FREE_LARGE(*buf, hdr.ioc_len);
                 RETURN(err);
@@ -156,7 +156,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
 }
 EXPORT_SYMBOL(obd_ioctl_getdata);
 
-int obd_ioctl_popdata(void *arg, void *data, int len)
+int obd_ioctl_popdata(void __user *arg, void *data, int len)
 {
        int err;
 
index 638a216..53ffaa2 100644 (file)
@@ -1335,7 +1335,7 @@ static obd_id last_object_id;
 
 static int
 echo_copyin_lsm (struct echo_device *ed, struct lov_stripe_md *lsm,
-                 void *ulsm, int ulsm_nob)
+                void __user *ulsm, int ulsm_nob)
 {
         struct echo_client_obd *ec = ed->ed_ec;
         int                     i;
@@ -2158,8 +2158,8 @@ out_env:
 #endif /* HAVE_SERVER_SUPPORT */
 
 static int echo_create_object(const struct lu_env *env, struct echo_device *ed,
-                              int on_target, struct obdo *oa, void *ulsm,
-                              int ulsm_nob, struct obd_trans_info *oti)
+                             int on_target, struct obdo *oa, void __user *ulsm,
+                             int ulsm_nob, struct obd_trans_info *oti)
 {
         struct echo_object     *eco;
         struct echo_client_obd *ec = ed->ed_ec;