From: Dan Carpenter Date: Fri, 28 Mar 2014 08:06:00 +0000 (+0300) Subject: Btrfs: kmalloc() doesn't return an ERR_PTR X-Git-Tag: firefly_0821_release~176^2~3883^2~25 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=84dbeb87d1439d3a6614c95e82429542434bafb9;p=firefly-linux-kernel-4.4.55.git Btrfs: kmalloc() doesn't return an ERR_PTR 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 Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 6778fa3c6ed2..59622366c613 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -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; }