From: Miaohe Lin Date: Tue, 22 Mar 2022 21:42:30 +0000 (-0700) Subject: mm/memory.c: use helper function range_in_vma() X-Git-Tag: v6.1-rc5~1778^2~149 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=88a359125a2b8f2437f09ab3b1af4815c89690d4;p=platform%2Fkernel%2Flinux-starfive.git mm/memory.c: use helper function range_in_vma() Use helper function range_in_vma() to check if address, address + size are within the vma range. Minor readability improvement. Link: https://lkml.kernel.org/r/20220219021441.29173-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memory.c b/mm/memory.c index 2dbb4ac..3cbcf3a 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1715,7 +1715,7 @@ static void zap_page_range_single(struct vm_area_struct *vma, unsigned long addr void zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, unsigned long size) { - if (address < vma->vm_start || address + size > vma->vm_end || + if (!range_in_vma(vma, address, address + size) || !(vma->vm_flags & VM_PFNMAP)) return;