Commit d177c207ba16b1db31283e2d1fee7ad4a863584b

Authored by Linas Vepstas
Committed by Paul Mackerras
1 parent 3914ac7b0e

[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 <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
(cherry picked from e71d9e598533c1889e7162f5f4647e5d378c102c commit)

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

arch/powerpc/mm/pgtable_64.c
... ... @@ -174,7 +174,7 @@
174 174 pa = addr & PAGE_MASK;
175 175 size = PAGE_ALIGN(addr + size) - pa;
176 176  
177   - if (size == 0)
  177 + if ((size == 0) || (pa == 0))
178 178 return NULL;
179 179  
180 180 if (mem_init_done) {