linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Patch] mm/sparse.c: Check the return value of sparse_index_alloc().
@ 2007-11-15 13:54 WANG Cong
  2007-11-16 21:37 ` Andrew Morton
  2007-11-19 21:17 ` Dave Hansen
  0 siblings, 2 replies; 12+ messages in thread
From: WANG Cong @ 2007-11-15 13:54 UTC (permalink / raw)
  To: LKML; +Cc: Rik van Riel, Christoph Lameter, Andrew Morton, linux-mm

Since sparse_index_alloc() can return NULL on memory allocation failure,
we must deal with the failure condition when calling it.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Rik van Riel <riel@redhat.com>

---

diff --git a/Makefile b/Makefile
diff --git a/mm/sparse.c b/mm/sparse.c
index e06f514..d245e59 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -83,6 +83,8 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid)
 		return -EEXIST;
 
 	section = sparse_index_alloc(nid);
+	if (!section)
+		return -ENOMEM;
 	/*
 	 * This lock keeps two different sections from
 	 * reallocating for the same index

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2007-11-29 17:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-15 13:54 [Patch] mm/sparse.c: Check the return value of sparse_index_alloc() WANG Cong
2007-11-16 21:37 ` Andrew Morton
2007-11-19 21:17 ` Dave Hansen
2007-11-20  4:57   ` WANG Cong
2007-11-23  5:51   ` [Patch] mm/sparse.c: Improve the error handling for sparse_add_one_section() WANG Cong
2007-11-26 10:19     ` Yasunori Goto
2007-11-27  2:26       ` [Patch](Resend) " WANG Cong
2007-11-27 11:55         ` Yasunori Goto
2007-11-27 18:53         ` Dave Hansen
2007-11-28 12:44           ` WANG Cong
2007-11-29  2:42             ` Yasunori Goto
2007-11-29 17:47             ` Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).