diff options
-rw-r--r-- | mm/memblock.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index d5d63ac1fd83..9ad39690a2bd 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -105,13 +105,18 @@ static phys_addr_t __init memblock_find_region(phys_addr_t start, phys_addr_t en | |||
105 | phys_addr_t base, res_base; | 105 | phys_addr_t base, res_base; |
106 | long j; | 106 | long j; |
107 | 107 | ||
108 | /* In case, huge size is requested */ | ||
109 | if (end < size) | ||
110 | return MEMBLOCK_ERROR; | ||
111 | |||
112 | base = memblock_align_down((end - size), align); | ||
113 | |||
108 | /* Prevent allocations returning 0 as it's also used to | 114 | /* Prevent allocations returning 0 as it's also used to |
109 | * indicate an allocation failure | 115 | * indicate an allocation failure |
110 | */ | 116 | */ |
111 | if (start == 0) | 117 | if (start == 0) |
112 | start = PAGE_SIZE; | 118 | start = PAGE_SIZE; |
113 | 119 | ||
114 | base = memblock_align_down((end - size), align); | ||
115 | while (start <= base) { | 120 | while (start <= base) { |
116 | j = memblock_overlaps_region(&memblock.reserved, base, size); | 121 | j = memblock_overlaps_region(&memblock.reserved, base, size); |
117 | if (j < 0) | 122 | if (j < 0) |