diff options
author | Philipp Hachtmann <phacht@linux.vnet.ibm.com> | 2014-01-10 12:41:29 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2014-01-10 12:41:29 +1100 |
commit | a7bceac61b6b0d9e6b2426e5da2c17ba0065fa40 (patch) | |
tree | 77823599c0bb6c71b95e8b60025ddedee53e8073 /mm | |
parent | 476022a7bf537178774a280634335690b7e155eb (diff) |
mm/nobootmem.c: add return value check in __alloc_memory_core_early()
When memblock_reserve() fails because memblock.reserved.regions cannot be
resized, the caller (e.g. alloc_bootmem()) is not informed of the failed
allocation. Therefore alloc_bootmem() silently returns the same pointer
again and again.
This patch adds a check for the return value of memblock_reserve() in
__alloc_memory_core().
Signed-off-by: Philipp Hachtmann <phacht@linux.vnet.ibm.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/nobootmem.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 19121ceb8874..bb1a70cc97a7 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c @@ -45,7 +45,9 @@ static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align, if (!addr) return NULL; - memblock_reserve(addr, size); + if (memblock_reserve(addr, size)) + return NULL; + ptr = phys_to_virt(addr); memset(ptr, 0, size); /* |