Btrfs: kmalloc() doesn't return an ERR_PTR
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 28 Mar 2014 08:06:00 +0000 (11:06 +0300)
committerChris Mason <clm@fb.com>
Mon, 7 Apr 2014 16:08:44 +0000 (09:08 -0700)
The error handling was copy and pasted from memdup_user().  It should be
checking for NULL obviously.

Fixes: abccd00f8af2 ('btrfs: Fix 32/64-bit problem with BTRFS_SET_RECEIVED_SUBVOL ioctl')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ioctl.c

index 6778fa3c6ed2f004094d24e00cc2cb725db72459..59622366c613dcd0a5099fb83eb6b02c55a50530 100644 (file)
@@ -4553,9 +4553,8 @@ static long btrfs_ioctl_set_received_subvol_32(struct file *file,
        }
 
        args64 = kmalloc(sizeof(*args64), GFP_NOFS);
-       if (IS_ERR(args64)) {
-               ret = PTR_ERR(args64);
-               args64 = NULL;
+       if (!args64) {
+               ret = -ENOMEM;
                goto out;
        }