]> git.karo-electronics.de Git - linux-beck.git/blobdiff - fs/btrfs/super.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[linux-beck.git] / fs / btrfs / super.c
index bf0e84c7560723ecb58a6381d76ca91b551ee456..3536bdb2d7cb0cc22cd149b1b561850881bbb096 100644 (file)
@@ -648,14 +648,9 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       vol = kmalloc(sizeof(*vol), GFP_KERNEL);
-       if (!vol)
-               return -ENOMEM;
-
-       if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) {
-               ret = -EFAULT;
-               goto out;
-       }
+       vol = memdup_user((void __user *)arg, sizeof(*vol));
+       if (IS_ERR(vol))
+               return PTR_ERR(vol);
 
        switch (cmd) {
        case BTRFS_IOC_SCAN_DEV:
@@ -663,7 +658,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
                                            &btrfs_fs_type, &fs_devices);
                break;
        }
-out:
+
        kfree(vol);
        return ret;
 }