From cab55442e8844e79a8a2630edcc6cf31432e2301 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 17 Jun 2021 20:31:19 -0400 Subject: [PATCH] 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. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index ca54d36d203ae..1e6fd4b2877e3 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2992,14 +2992,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; -- 2.50.1