Commit f544e14f authored by Yinghai Lu's avatar Yinghai Lu Committed by Linus Torvalds

memblock: add limit checking to memblock_virt_alloc

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Reported-by: default avatarKevin Hilman <khilman@linaro.org>
Tested-by: default avatarKevin Hilman <khilman@linaro.org>
Reported-by: default avatarOlof Johansson <olof@lixom.net>
Tested-by: default avatarOlof Johansson <olof@lixom.net>
Reported-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: "Strashko, Grygorii" <grygorii.strashko@ti.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 58d5640e
...@@ -1077,6 +1077,9 @@ static void * __init memblock_virt_alloc_internal( ...@@ -1077,6 +1077,9 @@ static void * __init memblock_virt_alloc_internal(
if (!align) if (!align)
align = SMP_CACHE_BYTES; align = SMP_CACHE_BYTES;
if (max_addr > memblock.current_limit)
max_addr = memblock.current_limit;
again: again:
alloc = memblock_find_in_range_node(size, align, min_addr, max_addr, alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
nid); nid);
......
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