Skip to content

Commit

Permalink
[PATCH] powerpc: IOMMU: don't ioremap null addresses
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Linas Vepstas authored and Paul Mackerras committed Jan 10, 2006
1 parent 3914ac7 commit d177c20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/mm/pgtable_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d177c20

Please sign in to comment.