public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] btrfs: cleanup fs/btrfs/super.c::btrfs_control_ioctl()
@ 2009-01-19 13:36 Américo Wang
  0 siblings, 0 replies; only message in thread
From: Américo Wang @ 2009-01-19 13:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Chris Mason, LKML, Andrew Morton


- Remove the unused local variable 'len';
- Check return value of kmalloc().

Signed-off-by: WANG Cong <wangcong@zeuux.org>
Cc: Chris Mason <chris.mason@oracle.com>

---
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index db9fb3b..0e9d259 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -583,17 +583,18 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
 	struct btrfs_ioctl_vol_args *vol;
 	struct btrfs_fs_devices *fs_devices;
 	int ret = -ENOTTY;
-	int len;
 
 	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;
 	}
-	len = strnlen(vol->name, BTRFS_PATH_NAME_MAX);
 
 	switch (cmd) {
 	case BTRFS_IOC_SCAN_DEV:


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-19 13:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-19 13:36 [Patch] btrfs: cleanup fs/btrfs/super.c::btrfs_control_ioctl() Américo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox