mm/memblock.c: fix memblock_next_valid_pfn()
[email protected]
maintainerPATCH 18/26 mm/memblock.c: fix memblock_next_valid_pfn()
From: AKASHI Takahiro <[email protected]>
Subject: mm/memblock.c: fix memblock_next_valid_pfn()
Obviously, we should not access memblock.memory.regions[right] if 'right' is outside of [0..memblock.memory.cnt>.
Fixes b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns where possible")
Signed-off-by AKASHI Takahiro <[email protected]>
Cc Paul Burton <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
mm/memblock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/memblock.c renamed from mm/memblock.c~memblock-fix-memblock_next_valid_pfn +4 -1
@@ -1118,7 +1118,10 @@ unsigned long __init_memblock memblock_n } }while (left < right); -return min (PHYS_PFN (type->regions[right].base), max_pfn); +if (right == type->cnt) +return max_pfn; +else +return min (PHYS_PFN (type->regions[right].base), max_pfn); }/**
_