[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e77ba42b-a2a4-5cdc-7038-287c28ef8cd7@redhat.com>
Date: Mon, 17 Apr 2023 12:33:01 +0200
From: David Hildenbrand <david@...hat.com>
To: Peng Zhang <zhangpeng362@...wei.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org
Cc: mike.kravetz@...cle.com, wangkefeng.wang@...wei.com,
sunnanyong@...wei.com
Subject: Re: [PATCH] userfaultfd: use helper function range_in_vma()
On 17.04.23 02:39, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@...wei.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@...wei.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@...hat.com>
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists