diff options
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r-- | drivers/of/fdt.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 79cb8313c7d8..d1ffca8b34ea 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -928,7 +928,11 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | |||
928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | 928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) |
929 | { | 929 | { |
930 | const u64 phys_offset = __pa(PAGE_OFFSET); | 930 | const u64 phys_offset = __pa(PAGE_OFFSET); |
931 | base &= PAGE_MASK; | 931 | |
932 | if (!PAGE_ALIGNED(base)) { | ||
933 | size -= PAGE_SIZE - (base & ~PAGE_MASK); | ||
934 | base = PAGE_ALIGN(base); | ||
935 | } | ||
932 | size &= PAGE_MASK; | 936 | size &= PAGE_MASK; |
933 | 937 | ||
934 | if (base > MAX_PHYS_ADDR) { | 938 | if (base > MAX_PHYS_ADDR) { |
@@ -937,10 +941,10 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
937 | return; | 941 | return; |
938 | } | 942 | } |
939 | 943 | ||
940 | if (base + size > MAX_PHYS_ADDR) { | 944 | if (base + size - 1 > MAX_PHYS_ADDR) { |
941 | pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", | 945 | pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", |
942 | ULONG_MAX, base + size); | 946 | ((u64)MAX_PHYS_ADDR) + 1, base + size); |
943 | size = MAX_PHYS_ADDR - base; | 947 | size = MAX_PHYS_ADDR - base + 1; |
944 | } | 948 | } |
945 | 949 | ||
946 | if (base + size < phys_offset) { | 950 | if (base + size < phys_offset) { |