From: Colin Cross Date: Sat, 14 Dec 2013 03:26:23 +0000 (-0800) Subject: ion: check return value from remap_pfn_range X-Git-Tag: next-20131220~15^2~141 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e460bc5e43f0750c8bdb6967058ed4f18e92812c;p=karo-tx-linux.git ion: check return value from remap_pfn_range Check the return value of remap_pfn_range and return an error if it fails. Signed-off-by: Colin Cross Signed-off-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c index ce3156163704..ecc14fd9f6ac 100644 --- a/drivers/staging/android/ion/ion_heap.c +++ b/drivers/staging/android/ion/ion_heap.c @@ -76,6 +76,7 @@ int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer, unsigned long offset = vma->vm_pgoff * PAGE_SIZE; struct scatterlist *sg; int i; + int ret; for_each_sg(table->sgl, sg, table->nents, i) { struct page *page = sg_page(sg); @@ -91,8 +92,10 @@ int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer, offset = 0; } len = min(len, remainder); - remap_pfn_range(vma, addr, page_to_pfn(page), len, + ret = remap_pfn_range(vma, addr, page_to_pfn(page), len, vma->vm_page_prot); + if (ret) + return ret; addr += len; if (addr >= vma->vm_end) return 0;