From: Linas Vepstas Date: Fri, 4 Nov 2005 00:55:14 +0000 (-0600) Subject: [PATCH] powerpc: IOMMU: don't ioremap null addresses X-Git-Tag: v2.6.16-rc1~473^2~8 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d177c207;p=linux-2.6-omap-h63xx.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 2ffca63602c..7b278d83739 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) {