diff mbox series

[128/212] remap_file_pages: Use vma_lookup() instead of find_vma()

Message ID 20210902215649.Oak625hS4%akpm@linux-foundation.org (mailing list archive)
State New
Headers show
Series [001/212] ia64: fix typo in a comment | expand

Commit Message

Andrew Morton Sept. 2, 2021, 9:56 p.m. UTC
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
Subject: 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 <Liam.Howlett@Oracle.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/mmap.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox series

Patch

--- a/mm/mmap.c~remap_file_pages-use-vma_lookup-instead-of-find_vma
+++ a/mm/mmap.c
@@ -2994,14 +2994,11 @@  SYSCALL_DEFINE5(remap_file_pages, unsign
 	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;