public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: chris.mason@oracle.com
Cc: linux-btrfs@vger.kernel.org
Subject: [patch] avoid null deref in unpin_extent_cache()
Date: Tue, 10 Nov 2009 11:01:43 +0200 (SAST)	[thread overview]
Message-ID: <alpine.DEB.2.00.0911072313580.30287@bicker> (raw)

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;

             reply	other threads:[~2009-11-10  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10  9:01 Dan Carpenter [this message]
2009-11-11 21:26 ` [patch] avoid null deref in unpin_extent_cache() Chris Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.0911072313580.30287@bicker \
    --to=error27@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox