Skip to content

Commit

Permalink
mm/sparse.c: check the return value of sparse_index_alloc()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
WANG Cong authored and Linus Torvalds committed Dec 18, 2007
1 parent bd6cba5 commit af0cd5a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mm/sparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit af0cd5a

Please sign in to comment.