diff options
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r-- | arch/arm/kernel/setup.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index b91411371ae1..ebfac782593f 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -523,7 +523,21 @@ int __init arm_add_memory(phys_addr_t start, unsigned long size) | |||
523 | */ | 523 | */ |
524 | size -= start & ~PAGE_MASK; | 524 | size -= start & ~PAGE_MASK; |
525 | bank->start = PAGE_ALIGN(start); | 525 | bank->start = PAGE_ALIGN(start); |
526 | bank->size = size & PAGE_MASK; | 526 | |
527 | #ifndef CONFIG_LPAE | ||
528 | if (bank->start + size < bank->start) { | ||
529 | printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " | ||
530 | "32-bit physical address space\n", (long long)start); | ||
531 | /* | ||
532 | * To ensure bank->start + bank->size is representable in | ||
533 | * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB. | ||
534 | * This means we lose a page after masking. | ||
535 | */ | ||
536 | size = ULONG_MAX - bank->start; | ||
537 | } | ||
538 | #endif | ||
539 | |||
540 | bank->size = size & PAGE_MASK; | ||
527 | 541 | ||
528 | /* | 542 | /* |
529 | * Check whether this memory region has non-zero size or | 543 | * Check whether this memory region has non-zero size or |