Skip to contentSkip to conversation

userfaultfd: eliminate meaningless check in userfaultfd_register()

PATCH New linmiaohe 1 participant 1 message Jun 1, 2020 VFS

lore
Share & tools
lore

linmiaohe

author
#0 lore raw

PATCH 1/1 userfaultfd: eliminate meaningless check in userfaultfd_register()

From: Miaohe Lin <[email protected]>

When we reach here, !(cur->vm_flags & VM_MAYWRITE) is already checked and equals to false. So the condition here always equals to false and should be eliminated.

---
 fs/userfaultfd.c | 2 --
 1 file changed, 2 deletions(-)
fs/userfaultfd.c +0 -2
index e39fdec8a0b0..e529e6bbb57b 100644
@@ -1409,8 +1409,6 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
 			if (end & (vma_hpagesize - 1))
 				goto out_unlock;
 		}
-		if ((vm_flags & VM_UFFD_WP) && !(cur->vm_flags & VM_MAYWRITE))
-			goto out_unlock;
 
 		/*
 		 * Check that this vma isn't already owned by a
Signature · 1 line
2.19.1