From e2d52f7b3adb0e5b80a068a2b2628bc8c2e01c6d Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Sun, 3 Jan 2016 12:05:37 -0500 Subject: [PATCH] staging/lustre: Add __user attributes to libcfs_ioctl_get/popdata args Just make clear which pointers are from userspace and which are not in libcfs_ioctl_getdata/libcfs_ioctl_popdata and their callers. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h | 4 ++-- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 6 +++--- drivers/staging/lustre/lustre/libcfs/module.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h index 3b16fcef1dad..0c31bf9b8e8d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h @@ -207,7 +207,7 @@ static inline int libcfs_ioctl_is_invalid(struct libcfs_ioctl_data *data) int libcfs_register_ioctl(struct libcfs_ioctl_handler *hand); int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand); -int libcfs_ioctl_getdata(char *buf, char *end, void *arg); -int libcfs_ioctl_popdata(void *arg, void *buf, int size); +int libcfs_ioctl_getdata(char *buf, char *end, void __user *arg); +int libcfs_ioctl_popdata(void __user *arg, void *buf, int size); #endif /* __LIBCFS_IOCTL_H__ */ diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c index eccfe8bd57a2..c089b044ef2e 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c @@ -40,7 +40,7 @@ #define LNET_MINOR 240 -int libcfs_ioctl_getdata(char *buf, char *end, void *arg) +int libcfs_ioctl_getdata(char *buf, char *end, void __user *arg) { struct libcfs_ioctl_hdr *hdr; struct libcfs_ioctl_data *data; @@ -88,9 +88,9 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg) return 0; } -int libcfs_ioctl_popdata(void *arg, void *data, int size) +int libcfs_ioctl_popdata(void __user *arg, void *data, int size) { - if (copy_to_user((char *)arg, data, size)) + if (copy_to_user(arg, data, size)) return -EFAULT; return 0; } diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index af516a29c20e..d5a047bd0180 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -116,7 +116,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand) EXPORT_SYMBOL(libcfs_deregister_ioctl); static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd, - void *arg, struct libcfs_ioctl_data *data) + void __user *arg, struct libcfs_ioctl_data *data) { int err = -EINVAL; @@ -157,7 +157,8 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd, return err; } -static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg) +static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, + void __user *arg) { char *buf; struct libcfs_ioctl_data *data; -- 2.20.1