summaryrefslogtreecommitdiffstats
path: root/arch/arm64/mm/init.c
diff options
context:
space:
mode:
authorMuchun Song <smuchun@gmail.com>2019-03-30 14:13:46 +0100
committerWill Deacon <will.deacon@arm.com>2019-04-01 16:35:48 +0200
commit344bf332ceb2364a2fcd3ab4133dce5ea35c2594 (patch)
tree4303cc7dbe951100ec85fb6bb07eae9a3dcaba27 /arch/arm64/mm/init.c
parentLinux 5.1-rc3 (diff)
downloadlinux-344bf332ceb2364a2fcd3ab4133dce5ea35c2594.tar.xz
linux-344bf332ceb2364a2fcd3ab4133dce5ea35c2594.zip
arm64: mm: fix incorrect assignment of 'max_mapnr'
Although we don't actually make use of the 'max_mapnr' global variable, we do set it to a junk value for !CONFIG_FLATMEM configurations that leave mem_map uninitialised. To avoid somebody tripping over this in future, set 'max_mapnr' using max_pfn, which is calculated directly from the memblock information. Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Muchun Song <smuchun@gmail.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/mm/init.c')
-rw-r--r--arch/arm64/mm/init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 6bc135042f5e..c29b17b520cd 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -535,7 +535,7 @@ void __init mem_init(void)
else
swiotlb_force = SWIOTLB_NO_FORCE;
- set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
+ set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
#ifndef CONFIG_SPARSEMEM_VMEMMAP
free_unused_memmap();