Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4eb3991c authored by Dan Carpenter's avatar Dan Carpenter Committed by Chris Mason
Browse files

Btrfs: avoid null deref in unpin_extent_cache()



I re-orderred the checks to avoid dereferencing "em" if it was null.

Found by smatch static checker.

Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent df66916e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len)
	write_lock(&tree->lock);
	em = lookup_extent_mapping(tree, start, len);

	WARN_ON(em->start != start || !em);
	WARN_ON(!em || em->start != start);

	if (!em)
		goto out;