[3/3] btrfs: remove impossible WARN_ON in btrfs_destroy_dev_replace_tgtdev()
diff mbox series

Message ID 20191205131959.19184-4-jth@kernel.org
State New
Headers show
  • Misc fixes silencing false positives from cppcheck
Related show

Commit Message

Johannes Thumshirn Dec. 5, 2019, 1:19 p.m. UTC
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

Link: https://bugzilla.kernel.org/show_bug.cgi?id=205003
Signed-off-by: Johannes Thumshirn <jth@kernel.org>
 fs/btrfs/volumes.c | 1 -
 1 file changed, 1 deletion(-)

diff mbox series

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c565650639ee..f5c0c401c330 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2132,7 +2132,6 @@  void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
 	struct btrfs_fs_devices *fs_devices = tgtdev->fs_info->fs_devices;
-	WARN_ON(!tgtdev);
 	btrfs_sysfs_rm_device_link(fs_devices, tgtdev);