From: Linas Vepstas Date: Fri, 4 Nov 2005 00:55:14 +0000 (-0600) Subject: [PATCH] powerpc: IOMMU: don't ioremap null addresses X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d177c207ba16b1db31283e2d1fee7ad4a863584b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [PATCH] powerpc: IOMMU: don't ioremap null addresses 240-ioremap-null-ptr-test.patch Under highly unusual circumstances, a buggy driver will ask a null ptr to be ioremapped, an operation that curently succeeds but leads to later trouble. Instead, refuse to remap the null pointer. Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras (cherry picked from e71d9e598533c1889e7162f5f4647e5d378c102c commit) --- diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index 2ffca63602c5..7b278d83739e 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c @@ -174,7 +174,7 @@ void __iomem * __ioremap(unsigned long addr, unsigned long size, pa = addr & PAGE_MASK; size = PAGE_ALIGN(addr + size) - pa; - if (size == 0) + if ((size == 0) || (pa == 0)) return NULL; if (mem_init_done) {