[lkml]   [2007]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[Patch] mm/sparse.c: Check the return value of sparse_index_alloc().

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 <>
Cc: Christoph Lameter <>
Cc: Rik van Riel <>


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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2007-11-15 14:59    [W:0.096 / U:0.684 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site