Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
memblock: add limit checking to memblock_virt_alloc
Browse files Browse the repository at this point in the history
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: Yinghai Lu <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Reported-by: Kevin Hilman <[email protected]>
Tested-by: Kevin Hilman <[email protected]>
Reported-by: Olof Johansson <[email protected]>
Tested-by: Olof Johansson <[email protected]>
Reported-by: Konrad Rzeszutek Wilk <[email protected]>
Tested-by: Konrad Rzeszutek Wilk <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Santosh Shilimkar <[email protected]>
Cc: "Strashko, Grygorii" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Yinghai Lu authored and torvalds committed Jan 30, 2014
1 parent 58d5640 commit f544e14
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/memblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,9 @@ static void * __init memblock_virt_alloc_internal(
if (!align)
align = SMP_CACHE_BYTES;

if (max_addr > memblock.current_limit)
max_addr = memblock.current_limit;

again:
alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
nid);
Expand Down

0 comments on commit f544e14

Please sign in to comment.