fs/userfaultfd.c: simplify the calculation of new_flags
diff mbox series

Message ID 20190806053859.2374-1-richardw.yang@linux.intel.com
State New
Headers show
Series
  • fs/userfaultfd.c: simplify the calculation of new_flags
Related show

Commit Message

Wei Yang Aug. 6, 2019, 5:38 a.m. UTC
Finally new_flags equals old vm_flags *OR* vm_flags.

It is not necessary to mask them first.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 fs/userfaultfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Yang Sept. 12, 2019, 2:54 a.m. UTC | #1
Ping~

On Tue, Aug 06, 2019 at 01:38:59PM +0800, Wei Yang wrote:
>Finally new_flags equals old vm_flags *OR* vm_flags.
>
>It is not necessary to mask them first.
>
>Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>---
> fs/userfaultfd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
>index ccbdbd62f0d8..653d8f7c453c 100644
>--- a/fs/userfaultfd.c
>+++ b/fs/userfaultfd.c
>@@ -1457,7 +1457,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
> 			start = vma->vm_start;
> 		vma_end = min(end, vma->vm_end);
> 
>-		new_flags = (vma->vm_flags & ~vm_flags) | vm_flags;
>+		new_flags = vma->vm_flags | vm_flags;
> 		prev = vma_merge(mm, prev, start, vma_end, new_flags,
> 				 vma->anon_vma, vma->vm_file, vma->vm_pgoff,
> 				 vma_policy(vma),
>-- 
>2.17.1

Patch
diff mbox series

diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index ccbdbd62f0d8..653d8f7c453c 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -1457,7 +1457,7 @@  static int userfaultfd_register(struct userfaultfd_ctx *ctx,
 			start = vma->vm_start;
 		vma_end = min(end, vma->vm_end);
 
-		new_flags = (vma->vm_flags & ~vm_flags) | vm_flags;
+		new_flags = vma->vm_flags | vm_flags;
 		prev = vma_merge(mm, prev, start, vma_end, new_flags,
 				 vma->anon_vma, vma->vm_file, vma->vm_pgoff,
 				 vma_policy(vma),