* [PATCH] userfaultfd: use helper function range_in_vma()
@ 2023-04-17 0:39 Peng Zhang
2023-04-17 10:33 ` David Hildenbrand
0 siblings, 1 reply; 2+ messages in thread
From: Peng Zhang @ 2023-04-17 0:39 UTC (permalink / raw)
To: linux-mm, linux-kernel, akpm
Cc: mike.kravetz, wangkefeng.wang, sunnanyong, ZhangPeng
From: ZhangPeng <zhangpeng362@huawei.com>
We could use range_in_vma() to check if dst_start, dst_start + len are
within the dst_vma range. Minor readability improvement.
Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
mm/userfaultfd.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index 11cfd82c6726..e97a0b4889fc 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -31,11 +31,7 @@ struct vm_area_struct *find_dst_vma(struct mm_struct *dst_mm,
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;
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] userfaultfd: use helper function range_in_vma()
2023-04-17 0:39 [PATCH] userfaultfd: use helper function range_in_vma() Peng Zhang
@ 2023-04-17 10:33 ` David Hildenbrand
0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2023-04-17 10:33 UTC (permalink / raw)
To: Peng Zhang, linux-mm, linux-kernel, akpm
Cc: mike.kravetz, wangkefeng.wang, sunnanyong
On 17.04.23 02:39, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@huawei.com>
>
> We could use range_in_vma() to check if dst_start, dst_start + len are
> within the dst_vma range. Minor readability improvement.
>
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
> ---
> mm/userfaultfd.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
> index 11cfd82c6726..e97a0b4889fc 100644
> --- a/mm/userfaultfd.c
> +++ b/mm/userfaultfd.c
> @@ -31,11 +31,7 @@ struct vm_area_struct *find_dst_vma(struct mm_struct *dst_mm,
> 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;
>
> /*
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-17 10:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-17 0:39 [PATCH] userfaultfd: use helper function range_in_vma() Peng Zhang
2023-04-17 10:33 ` David Hildenbrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).