From: Rebecca Schultz Zavin Date: Fri, 13 Dec 2013 22:23:58 +0000 (-0800) Subject: gpu: ion: Only map as much of the vma as the user requested X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b82302438bbb496c76d5c4d64d82263253b0ac2b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git gpu: ion: Only map as much of the vma as the user requested Signed-off-by: Rebecca Schultz Zavin [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index 3f607df63809..7397bc41fb45 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -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; }