The patch titled Subject: userfaultfd: use helper function range_in_vma() has been added to the -mm mm-unstable branch. Its filename is userfaultfd-use-helper-function-range_in_vma.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/userfaultfd-use-helper-function-range_in_vma.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: ZhangPeng <zhangpeng362@xxxxxxxxxx> Subject: userfaultfd: use helper function range_in_vma() Date: Mon, 17 Apr 2023 08:39:19 +0800 We can use range_in_vma() to check if dst_start, dst_start + len are within the dst_vma range. Minor readability improvement. Link: https://lkml.kernel.org/r/20230417003919.930515-1-zhangpeng362@xxxxxxxxxx Signed-off-by: ZhangPeng <zhangpeng362@xxxxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Cc: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Nanyong Sun <sunnanyong@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/userfaultfd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/mm/userfaultfd.c~userfaultfd-use-helper-function-range_in_vma +++ a/mm/userfaultfd.c @@ -31,11 +31,7 @@ struct vm_area_struct *find_dst_vma(stru struct vm_area_struct *dst_vma; dst_vma = find_vma(dst_mm, dst_start); - if (!dst_vma) - return NULL; - - if (dst_start < dst_vma->vm_start || - dst_start + len > dst_vma->vm_end) + if (!range_in_vma(dst_vma, dst_start, dst_start + len)) return NULL; /* _ Patches currently in -mm which might be from zhangpeng362@xxxxxxxxxx are mm-madvise-use-vma_lookup-instead-of-find_vma.patch userfaultfd-convert-mfill_atomic_pte_copy-to-use-a-folio.patch userfaultfd-use-kmap_local_page-in-copy_huge_page_from_user.patch userfaultfd-convert-copy_huge_page_from_user-to-copy_folio_from_user.patch userfaultfd-convert-mfill_atomic_hugetlb-to-use-a-folio.patch mm-convert-copy_user_huge_page-to-copy_user_large_folio.patch userfaultfd-convert-mfill_atomic-to-use-a-folio.patch userfaultfd-use-helper-function-range_in_vma.patch