Skip to contentSkip to conversation

btrfs: handle kmalloc() failure

PATCH New Dan Carpenter 1 participant 1 message Mar 20, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 btrfs: handle kmalloc() failure

Return -ENOMEM if kmalloc() fails.

fs/btrfs/ioctl.c +3 -0
index 15f661d..be9b5df 100644
@@ -1212,6 +1212,9 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file,
 		return -EPERM;
 
 	args = kmalloc(sizeof(*args), GFP_KERNEL);
+	if (!args)
+		return -ENOMEM;
+
 	if (copy_from_user(args, argp, sizeof(*args))) {
 		kfree(args);
 		return -EFAULT;