Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dma-buf: use vma_pages()

Replace explicit computation of vma page count by a call to
vma_pages().
Also, include <linux/mm.h>

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>

authored by

Muhammad Falak R Wani and committed by
Sumit Semwal
b02da6f8 4320c2a2

+4 -3
+4 -3
drivers/dma-buf/dma-buf.c
··· 33 33 #include <linux/seq_file.h> 34 34 #include <linux/poll.h> 35 35 #include <linux/reservation.h> 36 + #include <linux/mm.h> 36 37 37 38 #include <uapi/linux/dma-buf.h> 38 39 ··· 91 90 dmabuf = file->private_data; 92 91 93 92 /* check for overflowing the buffer's size */ 94 - if (vma->vm_pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) > 93 + if (vma->vm_pgoff + vma_pages(vma) > 95 94 dmabuf->size >> PAGE_SHIFT) 96 95 return -EINVAL; 97 96 ··· 724 723 return -EINVAL; 725 724 726 725 /* check for offset overflow */ 727 - if (pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) < pgoff) 726 + if (pgoff + vma_pages(vma) < pgoff) 728 727 return -EOVERFLOW; 729 728 730 729 /* check for overflowing the buffer's size */ 731 - if (pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) > 730 + if (pgoff + vma_pages(vma) > 732 731 dmabuf->size >> PAGE_SHIFT) 733 732 return -EINVAL; 734 733