Whamcloud - gitweb
LU-5396 llite: add sparse annotation __user wherever needed 18/11818/3
authorFrank Zago <fzago@cray.com>
Wed, 23 Jul 2014 21:30:22 +0000 (16:30 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 18 Sep 2014 10:24:59 +0000 (10:24 +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: Ia56bf32ab880c34f8a121f7ba3a7cce546308448
Signed-off-by: frank zago <fzago@cray.com>
Reviewed-on: http://review.whamcloud.com/11818
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/lloop.c

index 6e1a005..3fa1059 100644 (file)
@@ -1062,7 +1062,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                 RETURN(ll_iocontrol(inode, file, cmd, arg));
         case FSFILT_IOC_GETVERSION_OLD:
         case FSFILT_IOC_GETVERSION:
-                RETURN(put_user(inode->i_generation, (int *)arg));
+               RETURN(put_user(inode->i_generation, (int __user *)arg));
         /* We need to special case any other ioctls we want to handle,
          * to send them to the MDS/OST as appropriate and to properly
          * network encode the arg field.
@@ -1076,7 +1076,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                 if (mdtidx < 0)
                         RETURN(mdtidx);
 
-                if (put_user((int)mdtidx, (int*)arg))
+               if (put_user((int)mdtidx, (int __user *)arg))
                         RETURN(-EFAULT);
 
                 return 0;
@@ -1086,7 +1086,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                char *buf = NULL;
                char *filename;
 
-               rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
+               rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg);
                if (rc != 0)
                        RETURN(rc);
                data = (void *)buf;
@@ -1119,7 +1119,7 @@ out_free:
                int              len;
                int              rc;
 
-               rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
+               rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg);
                if (rc)
                        RETURN(rc);
 
@@ -1175,8 +1175,10 @@ lmv_out_free:
         case LL_IOC_LOV_SETSTRIPE: {
                 struct lov_user_md_v3 lumv3;
                 struct lov_user_md_v1 *lumv1 = (struct lov_user_md_v1 *)&lumv3;
-                struct lov_user_md_v1 *lumv1p = (struct lov_user_md_v1 *)arg;
-                struct lov_user_md_v3 *lumv3p = (struct lov_user_md_v3 *)arg;
+               struct lov_user_md_v1 __user *lumv1p =
+                       (struct lov_user_md_v1 __user *)arg;
+               struct lov_user_md_v3 __user *lumv3p =
+                       (struct lov_user_md_v3 __user *)arg;
 
                 int set_default = 0;
 
@@ -1295,7 +1297,7 @@ finish_req:
                if (!(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_LVB_TYPE))
                        RETURN(-ENOTSUPP);
 
-               filename = ll_getname((const char *)arg);
+               filename = ll_getname((const char __user *)arg);
                if (IS_ERR(filename))
                        RETURN(PTR_ERR(filename));
 
@@ -1312,13 +1314,13 @@ out_rmdir:
        case LL_IOC_LOV_SWAP_LAYOUTS:
                RETURN(-EPERM);
        case IOC_OBD_STATFS:
-               RETURN(ll_obd_statfs(inode, (void *)arg));
+               RETURN(ll_obd_statfs(inode, (void __user *)arg));
         case LL_IOC_LOV_GETSTRIPE:
         case LL_IOC_MDC_GETINFO:
         case IOC_MDC_GETFILEINFO:
         case IOC_MDC_GETFILESTRIPE: {
                 struct ptlrpc_request *request = NULL;
-                struct lov_user_md *lump;
+               struct lov_user_md __user *lump;
                 struct lov_mds_md *lmm = NULL;
                 struct mdt_body *body;
                 char *filename = NULL;
@@ -1326,7 +1328,7 @@ out_rmdir:
 
                 if (cmd == IOC_MDC_GETFILEINFO ||
                     cmd == IOC_MDC_GETFILESTRIPE) {
-                        filename = ll_getname((const char *)arg);
+                       filename = ll_getname((const char __user *)arg);
                         if (IS_ERR(filename))
                                 RETURN(PTR_ERR(filename));
 
@@ -1355,10 +1357,10 @@ out_rmdir:
 
                 if (cmd == IOC_MDC_GETFILESTRIPE ||
                     cmd == LL_IOC_LOV_GETSTRIPE) {
-                        lump = (struct lov_user_md *)arg;
+                       lump = (struct lov_user_md __user *)arg;
                 } else {
-                        struct lov_user_mds_data *lmdp;
-                        lmdp = (struct lov_user_mds_data *)arg;
+                       struct lov_user_mds_data __user *lmdp;
+                       lmdp = (struct lov_user_mds_data __user *)arg;
                         lump = &lmdp->lmd_lmm;
                 }
                if (copy_to_user(lump, lmm, lmmsize)) {
@@ -1368,7 +1370,7 @@ out_rmdir:
                 }
         skip_lmm:
                 if (cmd == IOC_MDC_GETFILEINFO || cmd == LL_IOC_MDC_GETINFO) {
-                        struct lov_user_mds_data *lmdp;
+                       struct lov_user_mds_data __user *lmdp;
                         lstat_t st = { 0 };
 
                        st.st_dev       = inode->i_sb->s_dev;
@@ -1385,7 +1387,7 @@ out_rmdir:
                        st.st_ctime     = body->mbo_ctime;
                        st.st_ino       = inode->i_ino;
 
-                       lmdp = (struct lov_user_mds_data *)arg;
+                       lmdp = (struct lov_user_mds_data __user *)arg;
                        if (copy_to_user(&lmdp->lmd_st, &st, sizeof(st)))
                                 GOTO(out_req, rc = -EFAULT);
                 }
@@ -1398,14 +1400,14 @@ out_rmdir:
                 return rc;
         }
         case IOC_LOV_GETINFO: {
-                struct lov_user_mds_data *lumd;
+               struct lov_user_mds_data __user *lumd;
                 struct lov_stripe_md *lsm;
-                struct lov_user_md *lum;
+               struct lov_user_md __user *lum;
                 struct lov_mds_md *lmm;
                 int lmmsize;
                 lstat_t st;
 
-                lumd = (struct lov_user_mds_data *)arg;
+               lumd = (struct lov_user_mds_data __user *)arg;
                 lum = &lumd->lmd_lmm;
 
                 rc = ll_get_max_mdsize(sbi, &lmmsize);
@@ -1503,7 +1505,7 @@ out_rmdir:
                                    NULL);
                 if (rc) {
                         CDEBUG(D_QUOTA, "mdc ioctl %d failed: %d\n", cmd, rc);
-                       if (copy_to_user((void *)arg, check,
+                       if (copy_to_user((void __user *)arg, check,
                                              sizeof(*check)))
                                CDEBUG(D_QUOTA, "copy_to_user failed\n");
                         GOTO(out_poll, rc);
@@ -1513,7 +1515,7 @@ out_rmdir:
                                    NULL);
                 if (rc) {
                         CDEBUG(D_QUOTA, "osc ioctl %d failed: %d\n", cmd, rc);
-                       if (copy_to_user((void *)arg, check,
+                       if (copy_to_user((void __user *)arg, check,
                                              sizeof(*check)))
                                CDEBUG(D_QUOTA, "copy_to_user failed\n");
                         GOTO(out_poll, rc);
@@ -1537,7 +1539,8 @@ out_rmdir:
                 if (!qctl_20)
                         GOTO(out_quotactl_18, rc = -ENOMEM);
 
-               if (copy_from_user(qctl_18, (void *)arg, sizeof(*qctl_18)))
+               if (copy_from_user(qctl_18, (void __user *)arg,
+                                  sizeof(*qctl_18)))
                         GOTO(out_quotactl_20, rc = -ENOMEM);
 
                 QCTL_COPY(qctl_20, qctl_18);
@@ -1562,7 +1565,7 @@ out_rmdir:
                         QCTL_COPY(qctl_18, qctl_20);
                         qctl_18->obd_uuid = qctl_20->obd_uuid;
 
-                       if (copy_to_user((void *)arg, qctl_18,
+                       if (copy_to_user((void __user *)arg, qctl_18,
                                              sizeof(*qctl_18)))
                                 rc = -EFAULT;
                 }
@@ -1581,12 +1584,13 @@ out_rmdir:
                 if (!qctl)
                         RETURN(-ENOMEM);
 
-               if (copy_from_user(qctl, (void *)arg, sizeof(*qctl)))
+               if (copy_from_user(qctl, (void __user *)arg, sizeof(*qctl)))
                         GOTO(out_quotactl, rc = -EFAULT);
 
                 rc = quotactl_ioctl(sbi, qctl);
 
-               if (rc == 0 && copy_to_user((void *)arg, qctl, sizeof(*qctl)))
+               if (rc == 0 &&
+                   copy_to_user((void __user *)arg, qctl, sizeof(*qctl)))
                         rc = -EFAULT;
 
         out_quotactl:
@@ -1617,7 +1621,7 @@ out_rmdir:
                 int count, vallen;
                 struct obd_export *exp;
 
-               if (copy_from_user(&count, (int *)arg, sizeof(int)))
+               if (copy_from_user(&count, (int __user *)arg, sizeof(int)))
                         RETURN(-EFAULT);
 
                 /* get ost count when count is zero, get mdt count otherwise */
@@ -1630,26 +1634,27 @@ out_rmdir:
                         RETURN(rc);
                 }
 
-               if (copy_to_user((int *)arg, &count, sizeof(int)))
+               if (copy_to_user((int __user *)arg, &count, sizeof(int)))
                         RETURN(-EFAULT);
 
                 RETURN(0);
         }
         case LL_IOC_PATH2FID:
-               if (copy_to_user((void *)arg, ll_inode2fid(inode),
+               if (copy_to_user((void __user *)arg, ll_inode2fid(inode),
                                      sizeof(struct lu_fid)))
                         RETURN(-EFAULT);
                 RETURN(0);
         case LL_IOC_GET_CONNECT_FLAGS: {
-                RETURN(obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL, (void*)arg));
+               RETURN(obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL,
+                                    (void __user *)arg));
         }
         case OBD_IOC_CHANGELOG_SEND:
         case OBD_IOC_CHANGELOG_CLEAR:
-                rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg,
+               rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void __user *)arg,
                                     sizeof(struct ioc_changelog));
                 RETURN(rc);
        case OBD_IOC_FID2PATH:
-               RETURN(ll_fid2path(inode, (void *)arg));
+               RETURN(ll_fid2path(inode, (void __user *)arg));
        case LL_IOC_FID2MDTIDX: {
                struct obd_export *exp = ll_i2mdexp(inode);
                struct lu_fid     fid;
@@ -1661,7 +1666,7 @@ out_rmdir:
 
                /* Call mdc_iocontrol */
                rc = obd_iocontrol(LL_IOC_FID2MDTIDX, exp, sizeof(fid), &fid,
-                                  &index);
+                                  (__u32 __user *)&index);
                if (rc != 0)
                        RETURN(rc);
 
@@ -1676,7 +1681,7 @@ out_rmdir:
                        RETURN(-ENOMEM);
 
                /* We don't know the true size yet; copy the fixed-size part */
-               if (copy_from_user(hur, (void *)arg, sizeof(*hur))) {
+               if (copy_from_user(hur, (void __user *)arg, sizeof(*hur))) {
                        OBD_FREE_PTR(hur);
                        RETURN(-EFAULT);
                }
@@ -1696,7 +1701,7 @@ out_rmdir:
                        RETURN(-ENOMEM);
 
                /* Copy the whole struct */
-               if (copy_from_user(hur, (void *)arg, totalsize)) {
+               if (copy_from_user(hur, (void __user *)arg, totalsize)) {
                        OBD_FREE_LARGE(hur, totalsize);
                        RETURN(-EFAULT);
                }
@@ -1732,7 +1737,7 @@ out_rmdir:
                struct hsm_progress_kernel      hpk;
                struct hsm_progress             hp;
 
-               if (copy_from_user(&hp, (void *)arg, sizeof(hp)))
+               if (copy_from_user(&hp, (void __user *)arg, sizeof(hp)))
                        RETURN(-EFAULT);
 
                hpk.hpk_fid = hp.hp_fid;
@@ -1752,7 +1757,7 @@ out_rmdir:
                if (!cfs_capable(CFS_CAP_SYS_ADMIN))
                        RETURN(-EPERM);
 
-               rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg,
+               rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void __user *)arg,
                                    sizeof(struct lustre_kernelcomm));
                RETURN(rc);
 
@@ -1763,13 +1768,13 @@ out_rmdir:
                OBD_ALLOC_PTR(copy);
                if (copy == NULL)
                        RETURN(-ENOMEM);
-               if (copy_from_user(copy, (char *)arg, sizeof(*copy))) {
+               if (copy_from_user(copy, (char __user *)arg, sizeof(*copy))) {
                        OBD_FREE_PTR(copy);
                        RETURN(-EFAULT);
                }
 
                rc = ll_ioc_copy_start(inode->i_sb, copy);
-               if (copy_to_user((char *)arg, copy, sizeof(*copy)))
+               if (copy_to_user((char __user *)arg, copy, sizeof(*copy)))
                        rc = -EFAULT;
 
                OBD_FREE_PTR(copy);
@@ -1782,13 +1787,13 @@ out_rmdir:
                OBD_ALLOC_PTR(copy);
                if (copy == NULL)
                        RETURN(-ENOMEM);
-               if (copy_from_user(copy, (char *)arg, sizeof(*copy))) {
+               if (copy_from_user(copy, (char __user *)arg, sizeof(*copy))) {
                        OBD_FREE_PTR(copy);
                        RETURN(-EFAULT);
                }
 
                rc = ll_ioc_copy_end(inode->i_sb, copy);
-               if (copy_to_user((char *)arg, copy, sizeof(*copy)))
+               if (copy_to_user((char __user *)arg, copy, sizeof(*copy)))
                        rc = -EFAULT;
 
                OBD_FREE_PTR(copy);
@@ -1829,7 +1834,7 @@ migrate_free:
        }
        default:
                RETURN(obd_iocontrol(cmd, sbi->ll_dt_exp, 0, NULL,
-                                    (void *)arg));
+                                    (void __user *)arg));
        }
 }
 
index 7c00ed5..562ffd7 100644 (file)
@@ -1308,7 +1308,7 @@ static ssize_t ll_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
         RETURN(result);
 }
 
-static ssize_t ll_file_read(struct file *file, char *buf, size_t count,
+static ssize_t ll_file_read(struct file *file, char __user *buf, size_t count,
                             loff_t *ppos)
 {
         struct lu_env *env;
@@ -1374,8 +1374,8 @@ static ssize_t ll_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
         RETURN(result);
 }
 
-static ssize_t ll_file_write(struct file *file, const char *buf, size_t count,
-                             loff_t *ppos)
+static ssize_t ll_file_write(struct file *file, const char __user *buf,
+                            size_t count, loff_t *ppos)
 {
         struct lu_env *env;
         struct iovec  *local_iov;
@@ -1488,7 +1488,7 @@ static int ll_lov_recreate_obj(struct inode *inode, unsigned long arg)
        if (!cfs_capable(CFS_CAP_SYS_ADMIN))
                RETURN(-EPERM);
 
-       if (copy_from_user(&ucreat, (struct ll_recreate_obj *)arg,
+       if (copy_from_user(&ucreat, (struct ll_recreate_obj __user *)arg,
                           sizeof(ucreat)))
                RETURN(-EFAULT);
 
@@ -1507,7 +1507,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
        if (!cfs_capable(CFS_CAP_SYS_ADMIN))
                RETURN(-EPERM);
 
-       if (copy_from_user(&fid, (struct lu_fid *)arg, sizeof(fid)))
+       if (copy_from_user(&fid, (struct lu_fid __user *)arg, sizeof(fid)))
                RETURN(-EFAULT);
 
        fid_to_ostid(&fid, &oi);
@@ -1657,7 +1657,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file,
        if (lump == NULL)
                 RETURN(-ENOMEM);
 
-       if (copy_from_user(lump, (struct lov_user_md  *)arg, lum_size)) {
+       if (copy_from_user(lump, (struct lov_user_md __user *)arg, lum_size)) {
                OBD_FREE_LARGE(lump, lum_size);
                RETURN(-EFAULT);
        }
@@ -1673,8 +1673,10 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file,
 {
        struct lov_user_md_v3    lumv3;
        struct lov_user_md_v1   *lumv1 = (struct lov_user_md_v1 *)&lumv3;
-       struct lov_user_md_v1   *lumv1p = (struct lov_user_md_v1 *)arg;
-       struct lov_user_md_v3   *lumv3p = (struct lov_user_md_v3 *)arg;
+       struct lov_user_md_v1 __user *lumv1p =
+               (struct lov_user_md_v1 __user *)arg;
+       struct lov_user_md_v3 __user *lumv3p =
+               (struct lov_user_md_v3 __user *)arg;
        int                      lum_size, rc;
        __u64                    flags = FMODE_WRITE;
        ENTRY;
@@ -1700,7 +1702,7 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file,
                ll_layout_refresh(inode, &gen);
                lsm = ccc_inode_lsm_get(inode);
                rc = obd_iocontrol(LL_IOC_LOV_GETSTRIPE, ll_i2dtexp(inode),
-                                  0, lsm, (void *)arg);
+                                  0, lsm, (void __user *)arg);
                ccc_inode_lsm_put(inode, lsm);
        }
        RETURN(rc);
@@ -1715,7 +1717,7 @@ static int ll_lov_getstripe(struct inode *inode, unsigned long arg)
        lsm = ccc_inode_lsm_get(inode);
        if (lsm != NULL)
                rc = obd_iocontrol(LL_IOC_LOV_GETSTRIPE, ll_i2dtexp(inode), 0,
-                                  lsm, (void *)arg);
+                                  lsm, (void __user *)arg);
        ccc_inode_lsm_put(inode, lsm);
        RETURN(rc);
 }
@@ -1992,7 +1994,7 @@ static int ll_ioctl_fiemap(struct inode *inode, unsigned long arg)
                 ret_bytes += (fiemap_s->fm_mapped_extents *
                                  sizeof(struct ll_fiemap_extent));
 
-       if (copy_to_user((void *)arg, fiemap_s, ret_bytes))
+       if (copy_to_user((void __user *)arg, fiemap_s, ret_bytes))
                rc = -EFAULT;
 
 error:
@@ -2363,14 +2365,14 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
         switch(cmd) {
         case LL_IOC_GETFLAGS:
                 /* Get the current value of the file flags */
-                return put_user(fd->fd_flags, (int *)arg);
+               return put_user(fd->fd_flags, (int __user *)arg);
         case LL_IOC_SETFLAGS:
         case LL_IOC_CLRFLAGS:
                 /* Set or clear specific file flags */
                 /* XXX This probably needs checks to ensure the flags are
                  *     not abused, and to handle any flag side effects.
                  */
-                if (get_user(flags, (int *) arg))
+               if (get_user(flags, (int __user *) arg))
                         RETURN(-EFAULT);
 
                 if (cmd == LL_IOC_SETFLAGS) {
@@ -2394,7 +2396,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                struct file *file2;
                struct lustre_swap_layouts lsl;
 
-               if (copy_from_user(&lsl, (char *)arg,
+               if (copy_from_user(&lsl, (char __user *)arg,
                                       sizeof(struct lustre_swap_layouts)))
                        RETURN(-EFAULT);
 
@@ -2424,13 +2426,13 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                 RETURN(ll_iocontrol(inode, file, cmd, arg));
         case FSFILT_IOC_GETVERSION_OLD:
         case FSFILT_IOC_GETVERSION:
-                RETURN(put_user(inode->i_generation, (int *)arg));
+               RETURN(put_user(inode->i_generation, (int __user *)arg));
         case LL_IOC_GROUP_LOCK:
                 RETURN(ll_get_grouplock(inode, file, arg));
         case LL_IOC_GROUP_UNLOCK:
                 RETURN(ll_put_grouplock(inode, file, arg));
         case IOC_OBD_STATFS:
-                RETURN(ll_obd_statfs(inode, (void *)arg));
+               RETURN(ll_obd_statfs(inode, (void __user *)arg));
 
         /* We need to special case any other ioctls we want to handle,
          * to send them to the MDS/OST as appropriate and to properly
@@ -2441,25 +2443,26 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case LL_IOC_FLUSHCTX:
                RETURN(ll_flush_ctx(inode));
        case LL_IOC_PATH2FID: {
-               if (copy_to_user((void *)arg, ll_inode2fid(inode),
+               if (copy_to_user((void __user *)arg, ll_inode2fid(inode),
                                 sizeof(struct lu_fid)))
                        RETURN(-EFAULT);
 
                RETURN(0);
        }
        case OBD_IOC_FID2PATH:
-               RETURN(ll_fid2path(inode, (void *)arg));
+               RETURN(ll_fid2path(inode, (void __user *)arg));
        case LL_IOC_DATA_VERSION: {
                struct ioc_data_version idv;
                int rc;
 
-               if (copy_from_user(&idv, (char *)arg, sizeof(idv)))
+               if (copy_from_user(&idv, (char __user *)arg, sizeof(idv)))
                        RETURN(-EFAULT);
 
                idv.idv_flags &= LL_DV_RD_FLUSH | LL_DV_WR_FLUSH;
                rc = ll_data_version(inode, &idv.idv_version, idv.idv_flags);
 
-               if (rc == 0 && copy_to_user((char *) arg, &idv, sizeof(idv)))
+               if (rc == 0 &&
+                   copy_to_user((char __user *)arg, &idv, sizeof(idv)))
                        RETURN(-EFAULT);
 
                RETURN(rc);
@@ -2472,7 +2475,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                 if (mdtidx < 0)
                         RETURN(mdtidx);
 
-                if (put_user((int)mdtidx, (int*)arg))
+               if (put_user((int)mdtidx, (int __user *)arg))
                         RETURN(-EFAULT);
 
                 RETURN(0);
@@ -2499,7 +2502,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                rc = obd_iocontrol(cmd, ll_i2mdexp(inode), sizeof(*op_data),
                                   op_data, NULL);
 
-               if (copy_to_user((void *)arg, hus, sizeof(*hus)))
+               if (copy_to_user((void __user *)arg, hus, sizeof(*hus)))
                        rc = -EFAULT;
 
                ll_finish_md_op_data(op_data);
@@ -2514,7 +2517,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (hss == NULL)
                        RETURN(-ENOMEM);
 
-               if (copy_from_user(hss, (char *)arg, sizeof(*hss))) {
+               if (copy_from_user(hss, (char __user *)arg, sizeof(*hss))) {
                        OBD_FREE_PTR(hss);
                        RETURN(-EFAULT);
                }
@@ -2543,7 +2546,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                rc = obd_iocontrol(cmd, ll_i2mdexp(inode), sizeof(*op_data),
                                   op_data, NULL);
 
-               if (copy_to_user((char *)arg, hca, sizeof(*hca)))
+               if (copy_to_user((char __user *)arg, hca, sizeof(*hca)))
                        rc = -EFAULT;
 
                ll_finish_md_op_data(op_data);
@@ -2642,7 +2645,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (hui == NULL)
                        RETURN(-ENOMEM);
 
-               if (copy_from_user(hui, (void *)arg, sizeof(*hui))) {
+               if (copy_from_user(hui, (void __user *)arg, sizeof(*hui))) {
                        OBD_FREE_PTR(hui);
                        RETURN(-EFAULT);
                }
@@ -2661,7 +2664,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                        RETURN(err);
 
                RETURN(obd_iocontrol(cmd, ll_i2dtexp(inode), 0, NULL,
-                                    (void *)arg));
+                                    (void __user *)arg));
        }
        }
 }
index 722b1aa..33c7a5c 100644 (file)
@@ -885,7 +885,7 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret);
 int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
                  struct super_block *, struct lookup_intent *);
 void lustre_dump_dentry(struct dentry *, int recur);
-int ll_obd_statfs(struct inode *inode, void *arg);
+int ll_obd_statfs(struct inode *inode, void __user *arg);
 int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize);
 int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize);
 int ll_get_max_cookiesize(struct ll_sb_info *sbi, int *max_cookiesize);
index aa60a72..3bc3781 100644 (file)
@@ -2225,15 +2225,15 @@ int ll_iocontrol(struct inode *inode, struct file *file,
 
                 ptlrpc_req_finished(req);
 
-                RETURN(put_user(flags, (int *)arg));
+               RETURN(put_user(flags, (int __user *)arg));
         }
         case FSFILT_IOC_SETFLAGS: {
                struct lov_stripe_md *lsm;
                 struct obd_info oinfo = { { { 0 } } };
                 struct md_op_data *op_data;
 
-                if (get_user(flags, (int *)arg))
-                        RETURN(-EFAULT);
+               if (get_user(flags, (int __user *)arg))
+                       RETURN(-EFAULT);
 
                 op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
                                              LUSTRE_OPC_ANY, NULL);
@@ -2462,14 +2462,14 @@ out:
        RETURN(rc);
 }
 
-int ll_obd_statfs(struct inode *inode, void *arg)
+int ll_obd_statfs(struct inode *inode, void __user *arg)
 {
         struct ll_sb_info *sbi = NULL;
         struct obd_export *exp;
         char *buf = NULL;
         struct obd_ioctl_data *data = NULL;
         __u32 type;
-       __u32 flags;
+       __u32 __user flags;     /* not user, but obd_iocontrol is abused */
         int len = 0, rc;
 
         if (!inode || !(sbi = ll_i2sbi(inode)))
@@ -2669,7 +2669,7 @@ int ll_get_obd_name(struct inode *inode, unsigned int cmd, unsigned long arg)
         if (!obd)
                 RETURN(-ENOENT);
 
-       if (copy_to_user((void *)arg, obd->obd_name,
+       if (copy_to_user((void __user *)arg, obd->obd_name,
                         strlen(obd->obd_name) + 1))
                RETURN(-EFAULT);
 
@@ -2786,5 +2786,3 @@ void ll_compute_rootsquash_state(struct ll_sb_info *sbi)
        }
        up_write(&squash->rsi_sem);
 }
-
-
index c053464..b8d7ca5 100644 (file)
@@ -679,9 +679,10 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
                 else
                         fid_zero(&fid);
 
-                if (copy_to_user((struct lu_fid *)arg, &fid, sizeof(fid)))
-                        err = -EFAULT;
-                break;
+               if (copy_to_user((struct lu_fid __user *)arg,
+                                &fid, sizeof(fid)))
+                       err = -EFAULT;
+               break;
         }
 
         default:
@@ -748,8 +749,8 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
                 dev = MKDEV(lloop_major, lo->lo_number);
 
                 /* quit if the used pointer is writable */
-                if (put_user((long)old_encode_dev(dev), (long*)arg))
-                        GOTO(out, err = -EFAULT);
+               if (put_user((long)old_encode_dev(dev), (long __user *)arg))
+                       GOTO(out, err = -EFAULT);
 
                 bdev = blkdev_get_by_dev(dev, file->f_mode, NULL);
                 if (IS_ERR(bdev))