Commit e3e8ff41 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre: Mark obd_ioctl_popdata/getdata argument as __user

arg is a userspace pointer and marking it as such makes sparse happy.
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 922cb32c
...@@ -252,8 +252,8 @@ static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data) ...@@ -252,8 +252,8 @@ static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
#include "obd_support.h" #include "obd_support.h"
/* function defined in lustre/obdclass/<platform>/<platform>-module.c */ /* function defined in lustre/obdclass/<platform>/<platform>-module.c */
int obd_ioctl_getdata(char **buf, int *len, void *arg); int obd_ioctl_getdata(char **buf, int *len, void __user *arg);
int obd_ioctl_popdata(void *arg, void *data, int len); int obd_ioctl_popdata(void __user *arg, void *data, int len);
static inline void obd_ioctl_freedata(char *buf, int len) static inline void obd_ioctl_freedata(char *buf, int len)
{ {
......
...@@ -1279,7 +1279,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1279,7 +1279,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
char *filename; char *filename;
struct md_op_data *op_data; struct md_op_data *op_data;
rc = obd_ioctl_getdata(&buf, &len, (void *)arg); rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg);
if (rc) if (rc)
return rc; return rc;
data = (void *)buf; data = (void *)buf;
...@@ -1321,7 +1321,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1321,7 +1321,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
int len; int len;
int rc; int rc;
rc = obd_ioctl_getdata(&buf, &len, (void *)arg); rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg);
if (rc) if (rc)
return rc; return rc;
......
...@@ -180,7 +180,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) ...@@ -180,7 +180,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
} }
CDEBUG(D_IOCTL, "cmd = %x\n", cmd); 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"); CERROR("OBD ioctl: data error\n");
return -EINVAL; return -EINVAL;
} }
...@@ -227,7 +227,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) ...@@ -227,7 +227,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
memcpy(data->ioc_bulk, BUILD_VERSION, memcpy(data->ioc_bulk, BUILD_VERSION,
strlen(BUILD_VERSION) + 1); strlen(BUILD_VERSION) + 1);
err = obd_ioctl_popdata((void *)arg, data, len); err = obd_ioctl_popdata((void __user *)arg, data, len);
if (err) if (err)
err = -EFAULT; err = -EFAULT;
goto out; goto out;
...@@ -246,7 +246,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) ...@@ -246,7 +246,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
goto out; goto out;
} }
err = obd_ioctl_popdata((void *)arg, data, sizeof(*data)); err = obd_ioctl_popdata((void __user *)arg, data,
sizeof(*data));
if (err) if (err)
err = -EFAULT; err = -EFAULT;
goto out; goto out;
...@@ -283,7 +284,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) ...@@ -283,7 +284,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
CDEBUG(D_IOCTL, "device name %s, dev %d\n", data->ioc_inlbuf1, CDEBUG(D_IOCTL, "device name %s, dev %d\n", data->ioc_inlbuf1,
dev); dev);
err = obd_ioctl_popdata((void *)arg, data, sizeof(*data)); err = obd_ioctl_popdata((void __user *)arg, data,
sizeof(*data));
if (err) if (err)
err = -EFAULT; err = -EFAULT;
goto out; goto out;
...@@ -330,7 +332,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) ...@@ -330,7 +332,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
(int)index, status, obd->obd_type->typ_name, (int)index, status, obd->obd_type->typ_name,
obd->obd_name, obd->obd_uuid.uuid, obd->obd_name, obd->obd_uuid.uuid,
atomic_read(&obd->obd_refcount)); atomic_read(&obd->obd_refcount));
err = obd_ioctl_popdata((void *)arg, data, len); err = obd_ioctl_popdata((void __user *)arg, data, len);
err = 0; err = 0;
goto out; goto out;
...@@ -388,7 +390,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) ...@@ -388,7 +390,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
if (err) if (err)
goto out; goto out;
err = obd_ioctl_popdata((void *)arg, data, len); err = obd_ioctl_popdata((void __user *)arg, data, len);
if (err) if (err)
err = -EFAULT; err = -EFAULT;
goto out; goto out;
......
...@@ -74,14 +74,14 @@ ...@@ -74,14 +74,14 @@
#include "../../include/lustre/lustre_build_version.h" #include "../../include/lustre/lustre_build_version.h"
/* buffer MUST be at least the size of obd_ioctl_hdr */ /* 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_hdr hdr;
struct obd_ioctl_data *data; struct obd_ioctl_data *data;
int err; int err;
int offset = 0; int offset = 0;
if (copy_from_user(&hdr, (void *)arg, sizeof(hdr))) if (copy_from_user(&hdr, arg, sizeof(hdr)))
return -EFAULT; return -EFAULT;
if (hdr.ioc_version != OBD_IOCTL_VERSION) { if (hdr.ioc_version != OBD_IOCTL_VERSION) {
...@@ -114,7 +114,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg) ...@@ -114,7 +114,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
*len = hdr.ioc_len; *len = hdr.ioc_len;
data = (struct obd_ioctl_data *)*buf; data = (struct obd_ioctl_data *)*buf;
if (copy_from_user(*buf, (void *)arg, hdr.ioc_len)) { if (copy_from_user(*buf, arg, hdr.ioc_len)) {
err = -EFAULT; err = -EFAULT;
goto free_buf; goto free_buf;
} }
...@@ -156,7 +156,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg) ...@@ -156,7 +156,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
} }
EXPORT_SYMBOL(obd_ioctl_getdata); 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; int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment