From: David Hildenbrand <david@redhat.com>
To: Peng Zhang <zhangpeng362@huawei.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org
Cc: mike.kravetz@oracle.com, wangkefeng.wang@huawei.com,
sunnanyong@huawei.com
Subject: Re: [PATCH] userfaultfd: use helper function range_in_vma()
Date: Mon, 17 Apr 2023 12:33:01 +0200 [thread overview]
Message-ID: <e77ba42b-a2a4-5cdc-7038-287c28ef8cd7@redhat.com> (raw)
In-Reply-To: <20230417003919.930515-1-zhangpeng362@huawei.com>
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
prev parent reply other threads:[~2023-04-17 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 0:39 [PATCH] userfaultfd: use helper function range_in_vma() Peng Zhang
2023-04-17 10:33 ` David Hildenbrand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e77ba42b-a2a4-5cdc-7038-287c28ef8cd7@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=sunnanyong@huawei.com \
--cc=wangkefeng.wang@huawei.com \
--cc=zhangpeng362@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).