summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2022-01-21 14:45:22 +0100
committerDavid Sterba <dsterba@suse.com>2022-01-31 16:06:21 +0100
commit37b4599547e324589e011c20f74b021d6d25cb7f (patch)
tree1f5d1e24dce5c05e261d24ae27f8228b30104103
parentbtrfs: fix use-after-free after failure to create a snapshot (diff)
downloadlinux-37b4599547e324589e011c20f74b021d6d25cb7f.tar.xz
linux-37b4599547e324589e011c20f74b021d6d25cb7f.zip
btrfs: fix use of uninitialized variable at rm device ioctl
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: 1a15eb724aae ("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>
-rw-r--r--fs/btrfs/ioctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 90c11ddff6e5..925522756e28 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -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;