]> git.hungrycats.org Git - linux/commit
btrfs: remove impossible WARN_ON in btrfs_destroy_dev_replace_tgtdev()
authorJohannes Thumshirn <jth@kernel.org>
Thu, 5 Dec 2019 13:19:59 +0000 (14:19 +0100)
committerDavid Sterba <dsterba@suse.com>
Fri, 6 Dec 2019 15:30:39 +0000 (16:30 +0100)
commitb510b0510b01eb8b058396a7aada67007a1b1c79
tree83e775a3fe089d104f38a5c75f1d4a41d090bd15
parent3cfff4cbcfa87050d0bb13c31e5c5fc0a85b549c
btrfs: remove impossible WARN_ON in btrfs_destroy_dev_replace_tgtdev()

We have a user report, that cppcheck is complaining about a possible
NULL-pointer dereference in btrfs_destroy_dev_replace_tgtdev().

We're first dereferencing the 'tgtdev' variable and the later check for
the validity of the pointer with a WARN_ON(!tgtdev);

But all callers of btrfs_destroy_dev_replace_tgtdev() either explicitly
check if 'tgtdev' is non-NULL or directly allocate 'tgtdev', so the
WARN_ON() is impossible to hit. Just remove it to silence the checker's
complains.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205003
Signed-off-by: Johannes Thumshirn <jth@kernel.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c