diff options
author | Wang Cong <xiyou.wangcong@gmail.com> | 2009-01-21 10:49:16 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-01-21 10:49:16 -0500 |
commit | 19d00cc196a3a66fd074f62b39d219f743b92338 (patch) | |
tree | f3c771837e17d7bcbdfe5b6c9f0911d85c90ca16 /fs | |
parent | c071fcfdb60e7abbe95e02460005d6bca165bf24 (diff) |
Btrfs: cleanup fs/btrfs/super.c::btrfs_control_ioctl()
- Remove the unused local variable 'len';
- Check return value of kmalloc().
Signed-off-by: Wang Cong <wangcong@zeuux.org>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/super.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 92c9b543deff..795b6246bcdf 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, | |||
583 | struct btrfs_ioctl_vol_args *vol; | 583 | struct btrfs_ioctl_vol_args *vol; |
584 | struct btrfs_fs_devices *fs_devices; | 584 | struct btrfs_fs_devices *fs_devices; |
585 | int ret = -ENOTTY; | 585 | int ret = -ENOTTY; |
586 | int len; | ||
587 | 586 | ||
588 | if (!capable(CAP_SYS_ADMIN)) | 587 | if (!capable(CAP_SYS_ADMIN)) |
589 | return -EPERM; | 588 | return -EPERM; |
590 | 589 | ||
591 | vol = kmalloc(sizeof(*vol), GFP_KERNEL); | 590 | vol = kmalloc(sizeof(*vol), GFP_KERNEL); |
591 | if (!vol) | ||
592 | return -ENOMEM; | ||
593 | |||
592 | if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) { | 594 | if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) { |
593 | ret = -EFAULT; | 595 | ret = -EFAULT; |
594 | goto out; | 596 | goto out; |
595 | } | 597 | } |
596 | len = strnlen(vol->name, BTRFS_PATH_NAME_MAX); | ||
597 | 598 | ||
598 | switch (cmd) { | 599 | switch (cmd) { |
599 | case BTRFS_IOC_SCAN_DEV: | 600 | case BTRFS_IOC_SCAN_DEV: |