From 97d63b5fc76054b24ed1a4bb6a3cc5ea043b0213 Mon Sep 17 00:00:00 2001 From: frank zago Date: Sun, 31 Aug 2014 20:16:09 -0500 Subject: [PATCH] LU-5396 lov: add sparse annotation __user wherever needed 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] *ids .../api-ni.c:1639:33: got struct lnet_process_id_t [usertype] * There is no code change. Change-Id: I67c89e141a30d175091673034d48c1aa75148891 Signed-off-by: frank zago Reviewed-on: http://review.whamcloud.com/11823 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/lov/lov_internal.h | 2 +- lustre/lov/lov_obd.c | 8 ++++---- lustre/lov/lov_pack.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index 134f512..6a222dd 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -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); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index bd574a7..fa0b70b 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -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; diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index bc1aab7..4326cea 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -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. -- 1.8.3.1