Commit 4e46f5c9 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: trivial part of drivers/block __user annotation

parent e7f962f1
......@@ -3079,19 +3079,19 @@ static int user_reset_fdc(int drive, int arg, int interruptible)
* Misc Ioctl's and support
* ========================
*/
static inline int fd_copyout(void *param, const void *address,
static inline int fd_copyout(void __user *param, const void *address,
unsigned long size)
{
return copy_to_user(param, address, size) ? -EFAULT : 0;
}
static inline int fd_copyin(void *param, void *address, unsigned long size)
static inline int fd_copyin(void __user *param, void *address, unsigned long size)
{
return copy_from_user(address, param, size) ? -EFAULT : 0;
}
#define _COPYOUT(x) (copy_to_user((void *)param, &(x), sizeof(x)) ? -EFAULT : 0)
#define _COPYIN(x) (copy_from_user(&(x), (void *)param, sizeof(x)) ? -EFAULT : 0)
#define _COPYOUT(x) (copy_to_user((void __user *)param, &(x), sizeof(x)) ? -EFAULT : 0)
#define _COPYIN(x) (copy_from_user(&(x), (void __user *)param, sizeof(x)) ? -EFAULT : 0)
#define COPYOUT(x) ECALL(_COPYOUT(x))
#define COPYIN(x) ECALL(_COPYIN(x))
......@@ -3166,7 +3166,7 @@ static struct cont_t raw_cmd_cont = {
.done = raw_cmd_done
};
static inline int raw_cmd_copyout(int cmd, char *param,
static inline int raw_cmd_copyout(int cmd, char __user *param,
struct floppy_raw_cmd *ptr)
{
int ret;
......@@ -3204,7 +3204,7 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr)
}
}
static inline int raw_cmd_copyin(int cmd, char *param,
static inline int raw_cmd_copyin(int cmd, char __user *param,
struct floppy_raw_cmd **rcmd)
{
struct floppy_raw_cmd *ptr;
......@@ -3258,7 +3258,7 @@ static inline int raw_cmd_copyin(int cmd, char *param,
}
}
static int raw_cmd_ioctl(int cmd, void *param)
static int raw_cmd_ioctl(int cmd, void __user *param)
{
int drive, ret, ret2;
struct floppy_raw_cmd *my_raw_cmd;
......@@ -3508,7 +3508,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
/* copyin */
CLEARSTRUCT(&inparam);
if (_IOC_DIR(cmd) & _IOC_WRITE)
ECALL(fd_copyin((void *)param, &inparam, size))
ECALL(fd_copyin((void __user *)param, &inparam, size))
switch (cmd) {
case FDEJECT:
......@@ -3604,7 +3604,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
return -EINVAL;
LOCK_FDC(drive, 1);
set_floppy(drive);
CALL(i = raw_cmd_ioctl(cmd, (void *)param));
CALL(i = raw_cmd_ioctl(cmd, (void __user *)param));
process_fd_request();
return i;
......@@ -3619,7 +3619,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
}
if (_IOC_DIR(cmd) & _IOC_READ)
return fd_copyout((void *)param, outparam, size);
return fd_copyout((void __user *)param, outparam, size);
else
return 0;
#undef OUT
......
......@@ -5,7 +5,7 @@
#include <linux/buffer_head.h>
#include <asm/uaccess.h>
static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg *arg)
static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user *arg)
{
struct block_device *bdevp;
struct gendisk *disk;
......@@ -109,27 +109,27 @@ static int blkdev_reread_part(struct block_device *bdev)
static int put_ushort(unsigned long arg, unsigned short val)
{
return put_user(val, (unsigned short *)arg);
return put_user(val, (unsigned short __user *)arg);
}
static int put_int(unsigned long arg, int val)
{
return put_user(val, (int *)arg);
return put_user(val, (int __user *)arg);
}
static int put_long(unsigned long arg, long val)
{
return put_user(val, (long *)arg);
return put_user(val, (long __user *)arg);
}
static int put_ulong(unsigned long arg, unsigned long val)
{
return put_user(val, (unsigned long *)arg);
return put_user(val, (unsigned long __user *)arg);
}
static int put_u64(unsigned long arg, u64 val)
{
return put_user(val, (u64 *)arg);
return put_user(val, (u64 __user *)arg);
}
int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
......@@ -172,7 +172,7 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
return -EACCES;
if (!arg)
return -EINVAL;
if (get_user(n, (int *) arg))
if (get_user(n, (int __user *) arg))
return -EFAULT;
if (bd_claim(bdev, file) < 0)
return -EBUSY;
......@@ -180,7 +180,7 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
bd_release(bdev);
return ret;
case BLKPG:
return blkpg_ioctl(bdev, (struct blkpg_ioctl_arg *) arg);
return blkpg_ioctl(bdev, (struct blkpg_ioctl_arg __user *) arg);
case BLKRRPART:
return blkdev_reread_part(bdev);
case BLKGETSIZE:
......@@ -209,7 +209,7 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
}
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (get_user(n, (int *)(arg)))
if (get_user(n, (int __user *)(arg)))
return -EFAULT;
set_device_ro(bdev, n);
return 0;
......
......@@ -949,7 +949,7 @@ loop_info64_to_old(const struct loop_info64 *info64, struct loop_info *info)
}
static int
loop_set_status_old(struct loop_device *lo, const struct loop_info *arg)
loop_set_status_old(struct loop_device *lo, const struct loop_info __user *arg)
{
struct loop_info info;
struct loop_info64 info64;
......@@ -961,7 +961,7 @@ loop_set_status_old(struct loop_device *lo, const struct loop_info *arg)
}
static int
loop_set_status64(struct loop_device *lo, const struct loop_info64 *arg)
loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg)
{
struct loop_info64 info64;
......@@ -971,7 +971,7 @@ loop_set_status64(struct loop_device *lo, const struct loop_info64 *arg)
}
static int
loop_get_status_old(struct loop_device *lo, struct loop_info *arg) {
loop_get_status_old(struct loop_device *lo, struct loop_info __user *arg) {
struct loop_info info;
struct loop_info64 info64;
int err = 0;
......@@ -989,7 +989,7 @@ loop_get_status_old(struct loop_device *lo, struct loop_info *arg) {
}
static int
loop_get_status64(struct loop_device *lo, struct loop_info64 *arg) {
loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) {
struct loop_info64 info64;
int err = 0;
......@@ -1021,16 +1021,16 @@ static int lo_ioctl(struct inode * inode, struct file * file,
err = loop_clr_fd(lo, inode->i_bdev);
break;
case LOOP_SET_STATUS:
err = loop_set_status_old(lo, (struct loop_info *) arg);
err = loop_set_status_old(lo, (struct loop_info __user *) arg);
break;
case LOOP_GET_STATUS:
err = loop_get_status_old(lo, (struct loop_info *) arg);
err = loop_get_status_old(lo, (struct loop_info __user *) arg);
break;
case LOOP_SET_STATUS64:
err = loop_set_status64(lo, (struct loop_info64 *) arg);
err = loop_set_status64(lo, (struct loop_info64 __user *) arg);
break;
case LOOP_GET_STATUS64:
err = loop_get_status64(lo, (struct loop_info64 *) arg);
err = loop_get_status64(lo, (struct loop_info64 __user *) arg);
break;
default:
err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
......
......@@ -771,7 +771,7 @@ static int pd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct pd_unit *disk = inode->i_bdev->bd_disk->private_data;
struct hd_geometry *geo = (struct hd_geometry *) arg;
struct hd_geometry __user *geo = (struct hd_geometry __user *) arg;
struct hd_geometry g;
switch (cmd) {
......
......@@ -33,7 +33,7 @@ struct blkpg_ioctl_arg {
int op;
int flags;
int datalen;
void *data;
void __user *data;
};
/* The subfunctions (for the op field) */
......
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