From: Miaohe Lin Date: Tue, 22 Mar 2022 21:46:41 +0000 (-0700) Subject: mm/madvise: use vma_lookup() instead of find_vma() X-Git-Tag: v6.1-rc5~1778^2~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=531037a06518094aba283194aa0d4808b0c47656;p=platform%2Fkernel%2Flinux-starfive.git mm/madvise: 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 the code. Link: https://lkml.kernel.org/r/20220311082731.63513-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/madvise.c b/mm/madvise.c index 7b5d6fc..2efcde2 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -849,8 +849,8 @@ static long madvise_populate(struct vm_area_struct *vma, * our VMA might have been split. */ if (!vma || start >= vma->vm_end) { - vma = find_vma(mm, start); - if (!vma || start < vma->vm_start) + vma = vma_lookup(mm, start); + if (!vma) return -ENOMEM; }