From: WANG Cong Date: Tue, 18 Dec 2007 00:19:58 +0000 (-0800) Subject: mm/sparse.c: check the return value of sparse_index_alloc() X-Git-Tag: v2.6.24-rc6~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af0cd5a7c3cded50c25e98acd94912d17a0eb914;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/sparse.c b/mm/sparse.c index e06f514..d245e590 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