From: Miaohe Lin Date: Tue, 22 Mar 2022 21:42:41 +0000 (-0700) Subject: mm/mremap:: use vma_lookup() instead of find_vma() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0e6799db9672dcdc995b0f4bfa5cde4420868c93;p=linux.git mm/mremap:: use vma_lookup() instead of find_vma() Using vma_lookup() verifies the address is contained in the found vma. This results in easier to read code. Link: https://lkml.kernel.org/r/20220312083118.48284-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Reviewed-by: Andrew Morton Reviewed-by: David Hildenbrand Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mremap.c b/mm/mremap.c index 002eec83e91e5..9d76da79594d9 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -942,8 +942,8 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, if (mmap_write_lock_killable(current->mm)) return -EINTR; - vma = find_vma(mm, addr); - if (!vma || vma->vm_start > addr) { + vma = vma_lookup(mm, addr); + if (!vma) { ret = EFAULT; goto out; }