[PATCH v2 2/3] btrfs: fix sparse address space warnings

From: Omar Sandoval
Date: Tue Sep 30 2014 - 18:01:49 EST


Several casts of ioctl fields from userspace are missing the __user annotation.

Signed-off-by: Omar Sandoval <osandov@xxxxxxxxxxx>
Reviewed-by: David Sterba <dsterba@xxxxxxx>
---
fs/btrfs/ioctl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 8a8e298..0f9a5a1 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2176,7 +2176,7 @@ static noinline int btrfs_ioctl_tree_search_v2(struct file *file,

inode = file_inode(file);
ret = search_ioctl(inode, &args.key, &buf_size,
- (char *)(&uarg->buf[0]));
+ (char __user *)(&uarg->buf[0]));
if (ret == 0 && copy_to_user(&uarg->key, &args.key, sizeof(args.key)))
ret = -EFAULT;
else if (ret == -EOVERFLOW &&
@@ -4247,7 +4247,7 @@ static long btrfs_ioctl_ino_to_path(struct btrfs_root *root, void __user *arg)
ipath->fspath->val[i] = rel_ptr;
}

- ret = copy_to_user((void *)(unsigned long)ipa->fspath,
+ ret = copy_to_user((void __user *)(unsigned long)ipa->fspath,
(void *)(unsigned long)ipath->fspath, size);
if (ret) {
ret = -EFAULT;
@@ -4322,7 +4322,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,
if (ret < 0)
goto out;

- ret = copy_to_user((void *)(unsigned long)loi->inodes,
+ ret = copy_to_user((void __user *)(unsigned long)loi->inodes,
(void *)(unsigned long)inodes, size);
if (ret)
ret = -EFAULT;
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/