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

From: Linas Vepstas
Date: Thu Nov 03 2005 - 19:56:32 EST


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@xxxxxxxxxxxxxx>

--
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) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/