mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 07:34:12 +08:00
userfaultfd: use helper function range_in_vma()
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@huawei.com Signed-off-by: ZhangPeng <zhangpeng362@huawei.com> Reviewed-by: David Hildenbrand <david@redhat.com> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Nanyong Sun <sunnanyong@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
13215e8a4b
commit
686ea6e61d
@ -31,11 +31,7 @@ struct vm_area_struct *find_dst_vma(struct mm_struct *dst_mm,
|
|||||||
struct vm_area_struct *dst_vma;
|
struct vm_area_struct *dst_vma;
|
||||||
|
|
||||||
dst_vma = find_vma(dst_mm, dst_start);
|
dst_vma = find_vma(dst_mm, dst_start);
|
||||||
if (!dst_vma)
|
if (!range_in_vma(dst_vma, dst_start, dst_start + len))
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (dst_start < dst_vma->vm_start ||
|
|
||||||
dst_start + len > dst_vma->vm_end)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user