From: Liam R. Howlett Date: Thu, 2 Sep 2021 21:56:49 +0000 (-0700) Subject: remap_file_pages: Use vma_lookup() instead of find_vma() X-Git-Tag: accepted/tizen/unified/20230118.172025~6477^2~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b593cb20283e68e5e65b09ca10038935297f05b;p=platform%2Fkernel%2Flinux-rpi.git remap_file_pages: Use vma_lookup() instead of find_vma() Using vma_lookup() verifies the start address is contained in the found vma. This results in easier to read code. Link: https://lkml.kernel.org/r/20210817135234.1550204-1-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett Reviewed-by: David Hildenbrand Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mmap.c b/mm/mmap.c index 79f4f8a..52fed23 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2994,14 +2994,11 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, if (mmap_write_lock_killable(mm)) return -EINTR; - vma = find_vma(mm, start); + vma = vma_lookup(mm, start); if (!vma || !(vma->vm_flags & VM_SHARED)) goto out; - if (start < vma->vm_start) - goto out; - if (start + size > vma->vm_end) { struct vm_area_struct *next;