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: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Oleg Drokin 2016-01-03 12:05:40 -05:00 committed by Greg Kroah-Hartman
parent 922cb32ca3
commit e3e8ff41c0
4 changed files with 16 additions and 14 deletions

View file

@ -252,8 +252,8 @@ static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
#include "obd_support.h"
/* function defined in lustre/obdclass/<platform>/<platform>-module.c */
int obd_ioctl_getdata(char **buf, int *len, void *arg);
int obd_ioctl_popdata(void *arg, void *data, int len);
int obd_ioctl_getdata(char **buf, int *len, void __user *arg);
int obd_ioctl_popdata(void __user *arg, void *data, int len);
static inline void obd_ioctl_freedata(char *buf, int len)
{

View file

@ -1279,7 +1279,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
char *filename;
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)
return rc;
data = (void *)buf;
@ -1321,7 +1321,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
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;

View file

@ -180,7 +180,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
}
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");
return -EINVAL;
}
@ -227,7 +227,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
memcpy(data->ioc_bulk, BUILD_VERSION,
strlen(BUILD_VERSION) + 1);
err = obd_ioctl_popdata((void *)arg, data, len);
err = obd_ioctl_popdata((void __user *)arg, data, len);
if (err)
err = -EFAULT;
goto out;
@ -246,7 +246,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
goto out;
}
err = obd_ioctl_popdata((void *)arg, data, sizeof(*data));
err = obd_ioctl_popdata((void __user *)arg, data,
sizeof(*data));
if (err)
err = -EFAULT;
goto out;
@ -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,
dev);
err = obd_ioctl_popdata((void *)arg, data, sizeof(*data));
err = obd_ioctl_popdata((void __user *)arg, data,
sizeof(*data));
if (err)
err = -EFAULT;
goto out;
@ -330,7 +332,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
(int)index, status, obd->obd_type->typ_name,
obd->obd_name, obd->obd_uuid.uuid,
atomic_read(&obd->obd_refcount));
err = obd_ioctl_popdata((void *)arg, data, len);
err = obd_ioctl_popdata((void __user *)arg, data, len);
err = 0;
goto out;
@ -388,7 +390,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
if (err)
goto out;
err = obd_ioctl_popdata((void *)arg, data, len);
err = obd_ioctl_popdata((void __user *)arg, data, len);
if (err)
err = -EFAULT;
goto out;

View file

@ -74,14 +74,14 @@
#include "../../include/lustre/lustre_build_version.h"
/* 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_data *data;
int err;
int offset = 0;
if (copy_from_user(&hdr, (void *)arg, sizeof(hdr)))
if (copy_from_user(&hdr, arg, sizeof(hdr)))
return -EFAULT;
if (hdr.ioc_version != OBD_IOCTL_VERSION) {
@ -114,7 +114,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
*len = hdr.ioc_len;
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;
goto free_buf;
}
@ -156,7 +156,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
}
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;