]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
MIPS: mm: Add check for highmem before removing memory block
authorKyle Hendry <kylehendrydev@gmail.com>
Sun, 21 Jun 2026 18:47:02 +0000 (11:47 -0700)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Mon, 29 Jun 2026 09:34:57 +0000 (11:34 +0200)
If a device has less physical memory than the highmem threshold
bootmem_init() doesn't set highstart_pfn. This results in highmem_init()
wrongly disabling the entire memory range if the cpu doesn't support
highmem. Add a check that highstart_pfn is non zero before removing the
highmem block.

Fixes: f171b55f1441 ("mips: fix HIGHMEM initialization")
Signed-off-by: Kyle Hendry <kylehendrydev@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/mm/init.c

index 1c07ca84ee21415ffab63b70814b7a9de8416e46..352718e43f697d6dcdb78fdac6d7e261fcff13e8 100644 (file)
@@ -426,10 +426,11 @@ static inline void __init highmem_init(void)
        unsigned long tmp;
 
        /*
-        * If CPU cannot support HIGHMEM discard the memory above highstart_pfn
+        * If CPU cannot support HIGHMEM discard any memory above highstart_pfn
         */
        if (cpu_has_dc_aliases) {
-               memblock_remove(PFN_PHYS(highstart_pfn), -1);
+               if (highstart_pfn)
+                       memblock_remove(PFN_PHYS(highstart_pfn), -1);
                return;
        }