summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>2023-06-16 16:38:15 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2023-06-21 14:08:53 +1000
commitc8eebc4a99f15280654f23e914e746c40a516e50 (patch)
tree7db9247bfdad27e6c39fc308339d73c31d73e332
parentd933557b858f78d7b702e70614b469a84b72e56c (diff)
downloadlinux-stable-c8eebc4a99f15280654f23e914e746c40a516e50.tar.gz
linux-stable-c8eebc4a99f15280654f23e914e746c40a516e50.tar.bz2
linux-stable-c8eebc4a99f15280654f23e914e746c40a516e50.zip
powerpc/mm/dax: Fix the condition when checking if altmap vmemap can cross-boundary
Without this fix, the last subsection vmemmap can end up in memory even if the namespace is created with -M mem and has sufficient space in the altmap area. Fixes: cf387d9644d8 ("libnvdimm/altmap: Track namespace boundaries in altmap") Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Tested-by: Sachin Sant <sachinp@linux.ibm.com <mailto:sachinp@linux.ibm.com>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230616110826.344417-6-aneesh.kumar@linux.ibm.com
-rw-r--r--arch/powerpc/mm/init_64.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 05b0d584e50b..fe1b83020e0d 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -189,7 +189,7 @@ static bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long star
unsigned long nr_pfn = page_size / sizeof(struct page);
unsigned long start_pfn = page_to_pfn((struct page *)start);
- if ((start_pfn + nr_pfn) > altmap->end_pfn)
+ if ((start_pfn + nr_pfn - 1) > altmap->end_pfn)
return true;
if (start_pfn < altmap->base_pfn)