powerpc/mm/altmap: Fix altmap boundary check
PATCH 1/1 powerpc/mm/altmap: Fix altmap boundary check
altmap->free includes the entire free space from which altmap blocks can be allocated. So when checking whether the kernel is doing altmap block free, compute the boundary correctly.
--- arch/powerpc/mm/init_64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/mm/init_64.c +1 -2
@@ -314,8 +314,7 @@ void __ref vmemmap_free(unsigned long start, unsigned long end, start =ALIGN_DOWN (start, page_size);if (altmap) { alt_start = altmap->base_pfn; - alt_end = altmap->base_pfn + altmap->reserve + - altmap->free + altmap->alloc + altmap->align; + alt_end = altmap->base_pfn + altmap->reserve + altmap->free; }pr_debug ("vmemmap_free %lx...%lx\n" , start, end);
Signature · 1 line
2.41.0
Quoted 17 lines · Aneesh Kumar K.V
altmap->freeincludes the entire free space from which altmap blocks can be allocated. So when checking whether the kernel is doing altmap block free, compute the boundary correctly.Cc David Hildenbrand <[email protected]>Cc Dan Williams <[email protected]>Fixes 9ef34630a461 ("powerpc/mm: Fallback to RAM if the altmap is unusable")Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/mm/init_64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/powerpc/mm/init_64.c +0
-0
arch/powerpc/mm/init_64.c void __ref vmemmap_free(unsigned long start, unsigned long end, · line 317
Quoted 6 lines
arch/powerpc/mm/init_64.c +1
-2@@ -314,8 +314,7 @@ void __ref vmemmap_free(unsigned long start, unsigned long end, start =ALIGN_DOWN (start, page_size);if (altmap) { alt_start = altmap->base_pfn; - alt_end = altmap->base_pfn + altmap->reserve + - altmap->free + altmap->alloc + altmap->align; + alt_end = altmap->base_pfn + altmap->reserve + altmap->free;
Right, align is treated like allocated and align+alloc cannot exceed free.
Signature · 3 lines
Cheers, David / dhildenb
Michael Ellerman
AppliedQuoted 5 lines · Aneesh Kumar K.V
altmap->freeincludes the entire free space from which altmap blocks can be allocated. So when checking whether the kernel is doing altmap block free, compute the boundary correctly.
Applied to powerpc/fixes.
[1/1] powerpc/mm/altmap: Fix altmap boundary check
https://git.kernel.org/powerpc/c/6722b25712054c0f903b839b8f5088438dd04df3
cheers