Commit 34d3d0e6 authored by Al Viro's avatar Al Viro Committed by Arnd Bergmann

do_vfs_ioctl(): use saner types

casting to pointer to int, only to pass that to function that
takes pointer to void and uses it as pointer to structure is
really asking for trouble.

"Some pointer, I'm not sure what to" is spelled "void *",
not "int *"; use that.

And declare the functions we are passing that pointer to
as taking the pointer to what they really want to access.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent bf0a199b
......@@ -175,10 +175,9 @@ static int fiemap_check_ranges(struct super_block *sb,
return 0;
}
static int ioctl_fiemap(struct file *filp, unsigned long arg)
static int ioctl_fiemap(struct file *filp, struct fiemap __user *ufiemap)
{
struct fiemap fiemap;
struct fiemap __user *ufiemap = (struct fiemap __user *) arg;
struct fiemap_extent_info fieinfo = { 0, };
struct inode *inode = file_inode(filp);
struct super_block *sb = inode->i_sb;
......@@ -245,7 +244,8 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
return ret;
}
static long ioctl_file_clone_range(struct file *file, void __user *argp)
static long ioctl_file_clone_range(struct file *file,
struct file_clone_range __user *argp)
{
struct file_clone_range args;
......@@ -585,9 +585,9 @@ static int ioctl_fsthaw(struct file *filp)
return thaw_super(sb);
}
static int ioctl_file_dedupe_range(struct file *file, void __user *arg)
static int ioctl_file_dedupe_range(struct file *file,
struct file_dedupe_range __user *argp)
{
struct file_dedupe_range __user *argp = arg;
struct file_dedupe_range *same = NULL;
int ret;
unsigned long size;
......@@ -636,7 +636,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
unsigned long arg)
{
int error = 0;
int __user *argp = (int __user *)arg;
void __user *argp = (void __user *)arg;
struct inode *inode = file_inode(filp);
switch (cmd) {
......@@ -675,13 +675,13 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
break;
case FS_IOC_FIEMAP:
return ioctl_fiemap(filp, arg);
return ioctl_fiemap(filp, argp);
case FIGETBSZ:
/* anon_bdev filesystems may not have a block size */
if (!inode->i_sb->s_blocksize)
return -EINVAL;
return put_user(inode->i_sb->s_blocksize, argp);
return put_user(inode->i_sb->s_blocksize, (int __user *)argp);
case FICLONE:
return ioctl_file_clone(filp, arg, 0, 0, 0);
......
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