Whamcloud - gitweb
LU-5396 lov: add sparse annotation __user wherever needed 23/11823/2
authorfrank zago <frank@zago.net>
Mon, 1 Sep 2014 01:16:09 +0000 (20:16 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 15 Sep 2014 18:20:49 +0000 (18:20 +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: I67c89e141a30d175091673034d48c1aa75148891
Signed-off-by: frank zago <fzago@cray.com>
Reviewed-on: http://review.whamcloud.com/11823
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
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: Oleg Drokin <oleg.drokin@intel.com>
lustre/lov/lov_internal.h
lustre/lov/lov_obd.c
lustre/lov/lov_pack.c

index 134f512..6a222dd 100644 (file)
@@ -199,7 +199,7 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmm,
 int lov_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
                  struct lov_mds_md *lmm, int lmm_bytes);
 int lov_getstripe(struct obd_export *exp,
-                  struct lov_stripe_md *lsm, struct lov_user_md *lump);
+                 struct lov_stripe_md *lsm, struct lov_user_md __user *lump);
 int lov_alloc_memmd(struct lov_stripe_md **lsmp, __u16 stripe_count,
                     int pattern, int magic);
 int lov_free_memmd(struct lov_stripe_md **lsmp);
index bd574a7..fa0b70b 100644 (file)
@@ -1476,7 +1476,7 @@ static int lov_statfs(const struct lu_env *env, struct obd_export *exp,
 }
 
 static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
-                         void *karg, void *uarg)
+                        void *karg, void __user *uarg)
 {
         struct obd_device *obddev = class_exp2obd(exp);
         struct lov_obd *lov = &obddev->u.lov;
@@ -1512,7 +1512,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                                     (int)sizeof(struct obd_uuid))))
                         RETURN(-EFAULT);
 
-               flags = uarg ? *(__u32*)uarg : 0;
+               flags = uarg ? *(__u32 __user *)uarg : 0;
                 /* got statfs data */
                 rc = obd_statfs(NULL, lov->lov_tgts[index]->ltd_exp, &stat_buf,
                                 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
@@ -1532,7 +1532,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 __u32 *genp;
 
                 len = 0;
-                if (obd_ioctl_getdata(&buf, &len, (void *)uarg))
+               if (obd_ioctl_getdata(&buf, &len, uarg))
                         RETURN(-EINVAL);
 
                 data = (struct obd_ioctl_data *)buf;
@@ -1565,7 +1565,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                         *genp = lov->lov_tgts[i]->ltd_gen;
                 }
 
-               if (copy_to_user((void *)uarg, buf, len))
+               if (copy_to_user(uarg, buf, len))
                         rc = -EFAULT;
                 obd_ioctl_freedata(buf, len);
                 break;
index bc1aab7..4326cea 100644 (file)
@@ -414,7 +414,7 @@ int lov_unpackmd(struct obd_export *exp,  struct lov_stripe_md **lsmp,
  * lmm_magic must be LOV_USER_MAGIC.
  */
 int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm,
-                  struct lov_user_md *lump)
+                 struct lov_user_md __user *lump)
 {
         /*
          * XXX huge struct allocated on stack.