diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ioctl.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7d40778a90e4..5e627746c4e8 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -310,11 +310,9 @@ static int btrfs_ioctl_resize(struct btrfs_root *root, void __user *arg) | |||
310 | ret = -EFAULT; | 310 | ret = -EFAULT; |
311 | goto out; | 311 | goto out; |
312 | } | 312 | } |
313 | |||
314 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; | ||
313 | namelen = strlen(vol_args->name); | 315 | namelen = strlen(vol_args->name); |
314 | if (namelen > BTRFS_VOL_NAME_MAX) { | ||
315 | ret = -EINVAL; | ||
316 | goto out; | ||
317 | } | ||
318 | 316 | ||
319 | mutex_lock(&root->fs_info->volume_mutex); | 317 | mutex_lock(&root->fs_info->volume_mutex); |
320 | sizestr = vol_args->name; | 318 | sizestr = vol_args->name; |
@@ -412,11 +410,8 @@ static noinline int btrfs_ioctl_snap_create(struct btrfs_root *root, | |||
412 | goto out; | 410 | goto out; |
413 | } | 411 | } |
414 | 412 | ||
413 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; | ||
415 | namelen = strlen(vol_args->name); | 414 | namelen = strlen(vol_args->name); |
416 | if (namelen > BTRFS_VOL_NAME_MAX) { | ||
417 | ret = -EINVAL; | ||
418 | goto out; | ||
419 | } | ||
420 | if (strchr(vol_args->name, '/')) { | 415 | if (strchr(vol_args->name, '/')) { |
421 | ret = -EINVAL; | 416 | ret = -EINVAL; |
422 | goto out; | 417 | goto out; |
@@ -487,6 +482,7 @@ long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) | |||
487 | ret = -EFAULT; | 482 | ret = -EFAULT; |
488 | goto out; | 483 | goto out; |
489 | } | 484 | } |
485 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; | ||
490 | ret = btrfs_init_new_device(root, vol_args->name); | 486 | ret = btrfs_init_new_device(root, vol_args->name); |
491 | 487 | ||
492 | out: | 488 | out: |
@@ -508,6 +504,7 @@ long btrfs_ioctl_rm_dev(struct btrfs_root *root, void __user *arg) | |||
508 | ret = -EFAULT; | 504 | ret = -EFAULT; |
509 | goto out; | 505 | goto out; |
510 | } | 506 | } |
507 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; | ||
511 | ret = btrfs_rm_device(root, vol_args->name); | 508 | ret = btrfs_rm_device(root, vol_args->name); |
512 | 509 | ||
513 | out: | 510 | out: |