gpu: ion: Only map as much of the vma as the user requested
authorRebecca Schultz Zavin <rebecca@android.com>
Fri, 10 Aug 2012 04:29:52 +0000 (21:29 -0700)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 20:40:56 +0000 (13:40 -0700)
Change-Id: If0e368e192941c118683ab74aed48e4e0cb5731d
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
drivers/gpu/ion/ion_system_heap.c

index 726448d43fc159fdfddb3773a95c13b4b0b7218b..e7fb07d45a2aa77a9dca0d89302a619b1303b987 100644 (file)
@@ -192,6 +192,8 @@ int ion_system_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,
                remap_pfn_range(vma, addr, page_to_pfn(sg_page(sg)),
                                sg_dma_len(sg), vma->vm_page_prot);
                addr += sg_dma_len(sg);
+               if (addr >= vma->vm_end)
+                       return 0;
        }
        return 0;
 }