powerpc/mm: Leave a gap between early allocated IO areas
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 19 Apr 2021 10:47:26 +0000 (10:47 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 24 Jun 2021 14:07:10 +0000 (00:07 +1000)
Vmalloc system leaves a gap between allocated areas. It helps catching
overflows.

Do the same for IO areas which are allocated with early_ioremap_range()
until slab_is_available().

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/c433e358190fb5d47650463ea1ab755fc7b73e6e.1618828806.git.christophe.leroy@csgroup.eu
arch/powerpc/mm/ioremap_32.c
arch/powerpc/mm/ioremap_64.c

index 743e11384deab8b1fa8bc66d40d8351164abd200..9d13143b8be496a8625f5b3ba7a76e86d2d15d71 100644 (file)
@@ -70,10 +70,10 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
         */
        pr_warn("ioremap() called early from %pS. Use early_ioremap() instead\n", caller);
 
-       err = early_ioremap_range(ioremap_bot - size, p, size, prot);
+       err = early_ioremap_range(ioremap_bot - size - PAGE_SIZE, p, size, prot);
        if (err)
                return NULL;
-       ioremap_bot -= size;
+       ioremap_bot -= size + PAGE_SIZE;
 
        return (void __iomem *)ioremap_bot + offset;
 }
index ba5cbb0d66bd6bc366ba5a3949cb82fb15f71bd6..3acece00b33e87680d83b37f9c16f69a5940e621 100644 (file)
@@ -38,7 +38,7 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
                return NULL;
 
        ret = (void __iomem *)ioremap_bot + offset;
-       ioremap_bot += size;
+       ioremap_bot += size + PAGE_SIZE;
 
        return ret;
 }