Commit 87379ec8 authored by Philipp Hachtmann's avatar Philipp Hachtmann Committed by Linus Torvalds

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
Signed-off-by: default avatarPhilipp Hachtmann <>
Reviewed-by: default avatarTejun Heo <>
Cc: Joonsoo Kim <>
Cc: Johannes Weiner <>
Cc: Tang Chen <>
Cc: Toshi Kani <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent d6441637
......@@ -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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment