All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Denis Kirjanov <kirjanov@gmail.com" <kirjanov@gmail.com>
To: joern@logfs.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] lib/btree: Fix possible NULL pointer dereference
Date: Thu, 13 May 2010 01:20:27 +0400	[thread overview]
Message-ID: <20100512212026.GA5513@coldcone> (raw)

mempool_alloc can return null in atomic case.

Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
---
diff --git a/lib/btree.c b/lib/btree.c
index 41859a8..542c904 100644
--- a/lib/btree.c
+++ b/lib/btree.c
@@ -95,7 +94,8 @@ static unsigned long *btree_node_alloc(struct btree_head *head, gfp_t gfp)
 	unsigned long *node;
 
 	node = mempool_alloc(head->mempool, gfp);
-	memset(node, 0, NODESIZE);
+	if (likely(node))
+		memset(node, 0, NODESIZE);
 	return node;
 }
 

             reply	other threads:[~2010-05-12 21:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 21:20 Denis Kirjanov <kirjanov@gmail.com [this message]
2010-05-13 20:19 ` [PATCH 2/2] lib/btree: Fix possible NULL pointer dereference Andrew Morton
2010-05-14 17:41   ` Jörn Engel

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=20100512212026.GA5513@coldcone \
    --to=kirjanov@gmail.com \
    --cc=joern@logfs.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.