提交 af0cd5a7 编写于 作者: W WANG Cong 提交者: Linus Torvalds

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: NWANG Cong <xiyou.wangcong@gmail.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 bd6cba53
...@@ -83,6 +83,8 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid) ...@@ -83,6 +83,8 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid)
return -EEXIST; return -EEXIST;
section = sparse_index_alloc(nid); section = sparse_index_alloc(nid);
if (!section)
return -ENOMEM;
/* /*
* This lock keeps two different sections from * This lock keeps two different sections from
* reallocating for the same index * reallocating for the same index
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册