Commit 3e83f872 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: drivers/md annotation

parent bd12c17c
...@@ -1133,7 +1133,7 @@ static ioctl_fn lookup_ioctl(unsigned int cmd) ...@@ -1133,7 +1133,7 @@ static ioctl_fn lookup_ioctl(unsigned int cmd)
* As well as checking the version compatibility this always * As well as checking the version compatibility this always
* copies the kernel interface version out. * copies the kernel interface version out.
*/ */
static int check_version(unsigned int cmd, struct dm_ioctl *user) static int check_version(unsigned int cmd, struct dm_ioctl __user *user)
{ {
uint32_t version[3]; uint32_t version[3];
int r = 0; int r = 0;
...@@ -1168,7 +1168,7 @@ static void free_params(struct dm_ioctl *param) ...@@ -1168,7 +1168,7 @@ static void free_params(struct dm_ioctl *param)
vfree(param); vfree(param);
} }
static int copy_params(struct dm_ioctl *user, struct dm_ioctl **param) static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param)
{ {
struct dm_ioctl tmp, *dmi; struct dm_ioctl tmp, *dmi;
...@@ -1225,7 +1225,7 @@ static int ctl_ioctl(struct inode *inode, struct file *file, ...@@ -1225,7 +1225,7 @@ static int ctl_ioctl(struct inode *inode, struct file *file,
int r = 0; int r = 0;
unsigned int cmd; unsigned int cmd;
struct dm_ioctl *param; struct dm_ioctl *param;
struct dm_ioctl *user = (struct dm_ioctl *) u; struct dm_ioctl __user *user = (struct dm_ioctl __user *) u;
ioctl_fn fn = NULL; ioctl_fn fn = NULL;
size_t param_size; size_t param_size;
......
...@@ -1934,7 +1934,7 @@ static int autostart_array(dev_t startdev) ...@@ -1934,7 +1934,7 @@ static int autostart_array(dev_t startdev)
} }
static int get_version(void * arg) static int get_version(void __user * arg)
{ {
mdu_version_t ver; mdu_version_t ver;
...@@ -1948,7 +1948,7 @@ static int get_version(void * arg) ...@@ -1948,7 +1948,7 @@ static int get_version(void * arg)
return 0; return 0;
} }
static int get_array_info(mddev_t * mddev, void * arg) static int get_array_info(mddev_t * mddev, void __user * arg)
{ {
mdu_array_info_t info; mdu_array_info_t info;
int nr,working,active,failed,spare; int nr,working,active,failed,spare;
...@@ -1998,7 +1998,7 @@ static int get_array_info(mddev_t * mddev, void * arg) ...@@ -1998,7 +1998,7 @@ static int get_array_info(mddev_t * mddev, void * arg)
return 0; return 0;
} }
static int get_disk_info(mddev_t * mddev, void * arg) static int get_disk_info(mddev_t * mddev, void __user * arg)
{ {
mdu_disk_info_t info; mdu_disk_info_t info;
unsigned int nr; unsigned int nr;
...@@ -2389,7 +2389,8 @@ static int md_ioctl(struct inode *inode, struct file *file, ...@@ -2389,7 +2389,8 @@ static int md_ioctl(struct inode *inode, struct file *file,
{ {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
int err = 0; int err = 0;
struct hd_geometry *loc = (struct hd_geometry *) arg; void __user *argp = (void __user *)arg;
struct hd_geometry __user *loc = argp;
mddev_t *mddev = NULL; mddev_t *mddev = NULL;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
...@@ -2402,7 +2403,7 @@ static int md_ioctl(struct inode *inode, struct file *file, ...@@ -2402,7 +2403,7 @@ static int md_ioctl(struct inode *inode, struct file *file,
switch (cmd) switch (cmd)
{ {
case RAID_VERSION: case RAID_VERSION:
err = get_version((void *)arg); err = get_version(argp);
goto done; goto done;
case PRINT_RAID_DEBUG: case PRINT_RAID_DEBUG:
...@@ -2482,7 +2483,7 @@ static int md_ioctl(struct inode *inode, struct file *file, ...@@ -2482,7 +2483,7 @@ static int md_ioctl(struct inode *inode, struct file *file,
mdu_array_info_t info; mdu_array_info_t info;
if (!arg) if (!arg)
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
else if (copy_from_user(&info, (void*)arg, sizeof(info))) { else if (copy_from_user(&info, argp, sizeof(info))) {
err = -EFAULT; err = -EFAULT;
goto abort_unlock; goto abort_unlock;
} }
...@@ -2513,11 +2514,11 @@ static int md_ioctl(struct inode *inode, struct file *file, ...@@ -2513,11 +2514,11 @@ static int md_ioctl(struct inode *inode, struct file *file,
switch (cmd) switch (cmd)
{ {
case GET_ARRAY_INFO: case GET_ARRAY_INFO:
err = get_array_info(mddev, (void *)arg); err = get_array_info(mddev, argp);
goto done_unlock; goto done_unlock;
case GET_DISK_INFO: case GET_DISK_INFO:
err = get_disk_info(mddev, (void *)arg); err = get_disk_info(mddev, argp);
goto done_unlock; goto done_unlock;
case RESTART_ARRAY_RW: case RESTART_ARRAY_RW:
...@@ -2543,18 +2544,18 @@ static int md_ioctl(struct inode *inode, struct file *file, ...@@ -2543,18 +2544,18 @@ static int md_ioctl(struct inode *inode, struct file *file,
err = -EINVAL; err = -EINVAL;
goto abort_unlock; goto abort_unlock;
} }
err = put_user (2, (char *) &loc->heads); err = put_user (2, (char __user *) &loc->heads);
if (err) if (err)
goto abort_unlock; goto abort_unlock;
err = put_user (4, (char *) &loc->sectors); err = put_user (4, (char __user *) &loc->sectors);
if (err) if (err)
goto abort_unlock; goto abort_unlock;
err = put_user(get_capacity(mddev->gendisk)/8, err = put_user(get_capacity(mddev->gendisk)/8,
(short *) &loc->cylinders); (short __user *) &loc->cylinders);
if (err) if (err)
goto abort_unlock; goto abort_unlock;
err = put_user (get_start_sect(inode->i_bdev), err = put_user (get_start_sect(inode->i_bdev),
(long *) &loc->start); (long __user *) &loc->start);
goto done_unlock; goto done_unlock;
} }
...@@ -2573,7 +2574,7 @@ static int md_ioctl(struct inode *inode, struct file *file, ...@@ -2573,7 +2574,7 @@ static int md_ioctl(struct inode *inode, struct file *file,
case ADD_NEW_DISK: case ADD_NEW_DISK:
{ {
mdu_disk_info_t info; mdu_disk_info_t info;
if (copy_from_user(&info, (void*)arg, sizeof(info))) if (copy_from_user(&info, argp, sizeof(info)))
err = -EFAULT; err = -EFAULT;
else else
err = add_new_disk(mddev, &info); err = add_new_disk(mddev, &info);
......
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