[PATCH 40/42]: ppc64: IOMMU: don't ioremap null pointers

Linas Vepstas linas at linas.org
Fri Nov 4 11:55:14 EST 2005


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 suceeds but leads to later trouble.
Instead, refuse to remap the null pointer.

Signed-off-by: Linas Vepstas <linas at austin.ibm.com>

--
Index: linux-2.6.14-git3/arch/powerpc/mm/pgtable_64.c
===================================================================
--- linux-2.6.14-git3.orig/arch/powerpc/mm/pgtable_64.c	2005-11-02 14:59:56.507624778 -0600
+++ linux-2.6.14-git3/arch/powerpc/mm/pgtable_64.c	2005-11-02 15:01:04.284115774 -0600
@@ -185,7 +185,7 @@
 	pa = addr & PAGE_MASK;
 	size = PAGE_ALIGN(addr + size) - pa;
 
-	if (size == 0)
+	if ((size == 0) || (pa == 0))
 		return NULL;
 
 	if (mem_init_done) {



More information about the Linuxppc64-dev mailing list