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: Dan Carpenter <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
This commit is contained in:
Dan Carpenter 2009-11-10 09:01:43 +00:00 • committed by Chris Mason
commit 4eb3991c5d

View file

@ -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;