public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] avoid null deref in unpin_extent_cache()
@ 2009-11-10  9:01 Dan Carpenter
  2009-11-11 21:26 ` Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2009-11-10  9:01 UTC (permalink / raw)
  To: chris.mason; +Cc: linux-btrfs

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

Found by smatch static checker.

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/fs/btrfs/extent_map.c	2009-11-08 14:01:09.000000000 +0200
+++ devel/fs/btrfs/extent_map.c	2009-11-08 14:01:44.000000000 +0200
@@ -208,7 +208,7 @@
 	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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-11 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10  9:01 [patch] avoid null deref in unpin_extent_cache() Dan Carpenter
2009-11-11 21:26 ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox