dect
/
linux-2.6
Archived
13
0
Fork 0

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>
This commit is contained in:
Wang Cong 2009-01-21 10:49:16 -05:00 committed by Chris Mason
parent c071fcfdb6
commit 19d00cc196
1 changed files with 3 additions and 2 deletions

View File

@ -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: