Skip to content

Commit

Permalink
btrfs: fix use of uninitialized variable at rm device ioctl
Browse files Browse the repository at this point in the history
Clang static analysis reports this problem
ioctl.c:3333:8: warning: 3rd function call argument is an
  uninitialized value
    ret = exclop_start_or_cancel_reloc(fs_info,

cancel is only set in one branch of an if-check and is always used.  So
initialize to false.

Fixes: 1a15eb7 ("btrfs: use btrfs_get_dev_args_from_path in dev removal ioctls")
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Tom Rix authored and David Sterba committed Jan 31, 2022
1 parent 28b21c5 commit 37b4599
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3353,7 +3353,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
struct block_device *bdev = NULL;
fmode_t mode;
int ret;
bool cancel;
bool cancel = false;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;
Expand Down

0 comments on commit 37b4599

Please sign in to comment.