Skip to content

Commit

Permalink
Btrfs: cleanup fs/btrfs/super.c::btrfs_control_ioctl()
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Wang Cong authored and Chris Mason committed Jan 21, 2009
1 parent c071fcf commit 19d00cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 19d00cc

Please sign in to comment.