diff options
Diffstat (limited to 'arch/i386/kernel/setup.c')
-rw-r--r-- | arch/i386/kernel/setup.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 9b8c8a19824d..b48ac635f3c1 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -389,14 +389,24 @@ static void __init limit_regions(unsigned long long size) | |||
389 | } | 389 | } |
390 | } | 390 | } |
391 | for (i = 0; i < e820.nr_map; i++) { | 391 | for (i = 0; i < e820.nr_map; i++) { |
392 | if (e820.map[i].type == E820_RAM) { | 392 | current_addr = e820.map[i].addr + e820.map[i].size; |
393 | current_addr = e820.map[i].addr + e820.map[i].size; | 393 | if (current_addr < size) |
394 | if (current_addr >= size) { | 394 | continue; |
395 | e820.map[i].size -= current_addr-size; | 395 | |
396 | e820.nr_map = i + 1; | 396 | if (e820.map[i].type != E820_RAM) |
397 | return; | 397 | continue; |
398 | } | 398 | |
399 | if (e820.map[i].addr >= size) { | ||
400 | /* | ||
401 | * This region starts past the end of the | ||
402 | * requested size, skip it completely. | ||
403 | */ | ||
404 | e820.nr_map = i; | ||
405 | } else { | ||
406 | e820.nr_map = i + 1; | ||
407 | e820.map[i].size -= current_addr - size; | ||
399 | } | 408 | } |
409 | return; | ||
400 | } | 410 | } |
401 | } | 411 | } |
402 | 412 | ||