Skip to content

Commit

Permalink
Btrfs: avoid null deref in unpin_extent_cache()
Browse files Browse the repository at this point in the history
I re-orderred the checks to avoid dereferencing "em" if it was null.

Found by smatch static checker.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Dan Carpenter authored and Chris Mason committed Nov 11, 2009
1 parent df66916 commit 4eb3991
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/extent_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4eb3991

Please sign in to comment.