From: Wei Yang <richardw.yang@linux.intel.com>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Wei Yang <richardw.yang@linux.intel.com>
Subject: [PATCH 1/3] fs/userfaultfd.c: remove a redundant check on end
Date: Fri, 13 Sep 2019 05:31:08 +0800 [thread overview]
Message-ID: <20190912213110.3691-1-richardw.yang@linux.intel.com> (raw)
For the ending vma, there is a check to make sure the end is huge page
aligned.
The *if* check makes sure vm_start < end <= vm_end. While the first half
is not necessary, because the *for* clause makes sure vm_start < end.
This patch just removes it.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
fs/userfaultfd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 653d8f7c453c..9ce09ac619a2 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -1402,8 +1402,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
* If this vma contains ending address, and huge pages
* check alignment.
*/
- if (is_vm_hugetlb_page(cur) && end <= cur->vm_end &&
- end > cur->vm_start) {
+ if (is_vm_hugetlb_page(cur) && end <= cur->vm_end) {
unsigned long vma_hpagesize = vma_kernel_pagesize(cur);
ret = -EINVAL;
--
2.17.1
next reply other threads:[~2019-09-12 21:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 21:31 Wei Yang [this message]
2019-09-12 21:31 ` [PATCH 2/3] fs/userfaultfd.c: reorder the if check to reduce some computation Wei Yang
2019-09-12 21:31 ` [PATCH 3/3] fs/userfaultfd.c: wrap cheching huge page alignment into a helper Wei Yang
2019-10-12 9:16 ` [PATCH 1/3] fs/userfaultfd.c: remove a redundant check on end Wei Yang
2019-11-09 1:29 ` Wei Yang
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=20190912213110.3691-1-richardw.yang@linux.intel.com \
--to=richardw.yang@linux.intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).