dma-buf: use vma_pages().
Subsystems (2)
PATCH v2 1/1 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 <[email protected]>
--- drivers/dma-buf/dma-buf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/dma-buf/dma-buf.c +4 -3
@@ -33,6 +33,7 @@#include <linux/seq_file.h> #include <linux/poll.h> #include <linux/reservation.h> +#include <linux/mm.h> #include <uapi/linux/dma-buf.h>
@@ -90,7 +91,7 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma) dmabuf = file->private_data;/* check for overflowing the buffer's size */ -if (vma->vm_pgoff + ((vma->vm_end - vma->vm_start) >>PAGE_SHIFT ) > +if (vma->vm_pgoff +vma_pages (vma) > dmabuf->size >>PAGE_SHIFT )return -EINVAL ;
@@ -723,11 +724,11 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,return -EINVAL ;/* check for offset overflow */ -if (pgoff + ((vma->vm_end - vma->vm_start) >>PAGE_SHIFT ) < pgoff) +if (pgoff +vma_pages (vma) < pgoff)return -EOVERFLOW ;/* check for overflowing the buffer's size */ -if (pgoff + ((vma->vm_end - vma->vm_start) >>PAGE_SHIFT ) > +if (pgoff +vma_pages (vma) > dmabuf->size >>PAGE_SHIFT )return -EINVAL ;
Signature · 1 line
1.9.1
Quoted 3 lines · Muhammad Falak R Wani
Replace explicit computation of vma page count by a call to
vma_pages().
Also, include <linux/mm.h>
All good!
Reviewed-by Eric Engestrom <[email protected]>
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel