On Tue, Jun 21, 2022 at 10:41:19AM +0200, David Hildenbrand wrote: > > @@ -1726,10 +1728,15 @@ static int userfaultfd_copy(struct userfaultfd_ctx *ctx, > > goto out; > > if (uffdio_copy.mode & ~(UFFDIO_COPY_MODE_DONTWAKE|UFFDIO_COPY_MODE_WP)) > > goto out; > > + > > + mode_wp = uffdio_copy.mode & UFFDIO_COPY_MODE_WP; > > + > > + uffd_flags = mode_wp ? UFFD_FLAGS_WP : 0; > > why not simply > > uffd_flags = 0; > if (uffdio_copy.mode & UFFDIO_COPY_MODE_WP) > uffd_flags |= UFFD_FLAGS_WP; > > ? Seconded, or even one-line it? uffd_flags = (uffdio_copy.mode & UFFDIO_COPY_MODE_WP) ? UFFD_FLAGS_WP : 0; Thanks, -- Peter Xu