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 <xiyou.wangcong@gmail.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
WANG Cong 2007-12-17 16:19:58 -08:00 committed by Linus Torvalds
parent bd6cba53c5
commit af0cd5a7c3
1 changed files with 2 additions and 0 deletions

View File

@ -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