Btrfs: fix sparse warning
authorFabian Frederick <fabf@skynet.be>
Tue, 15 Jul 2014 19:17:17 +0000 (21:17 +0200)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:37:35 +0000 (13:37 -0700)
Fix the following sparse warning:
fs/btrfs/send.c:518:51: warning: incorrect type in argument 2 (different address spaces)
fs/btrfs/send.c:518:51:    expected char const [noderef] <asn:1>*<noident>
fs/btrfs/send.c:518:51:    got char *

We can safely use (const char __user *) with set_fs(KERNEL_DS)

__force added to avoid sparse-all warning:
fs/btrfs/send.c:518:40: warning: cast adds address space to expression (<asn:1>)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Reviewed-by: Zach Brown <zab@zabbo.net>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/send.c

index 6528aa6621819f31fae18eb9d337b1cfd624ba3a..b67e12eb7ca916b5b2dbc86fc3f9c8c3f9f7ae48 100644 (file)
@@ -515,7 +515,8 @@ static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off)
        set_fs(KERNEL_DS);
 
        while (pos < len) {
-               ret = vfs_write(filp, (char *)buf + pos, len - pos, off);
+               ret = vfs_write(filp, (__force const char __user *)buf + pos,
+                               len - pos, off);
                /* TODO handle that correctly */
                /*if (ret == -ERESTARTSYS) {
                        continue;