Message ID | 20210921010120.1256762-2-oupton@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | selftests: KVM: Fix some compiler warnings | expand |
On Tue, Sep 21, 2021 at 01:01:19AM +0000, Oliver Upton wrote: > Building demand_paging_test.c with clang throws the following warning: > > >> demand_paging_test.c:182:7: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses] > if (!pollfd[0].revents & POLLIN) > > Silence the warning by placing the bitwise operation within parentheses. > > Signed-off-by: Oliver Upton <oupton@google.com> > --- > tools/testing/selftests/kvm/demand_paging_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c > index e79c1b64977f..10edae425ab3 100644 > --- a/tools/testing/selftests/kvm/demand_paging_test.c > +++ b/tools/testing/selftests/kvm/demand_paging_test.c > @@ -179,7 +179,7 @@ static void *uffd_handler_thread_fn(void *arg) > return NULL; > } > > - if (!pollfd[0].revents & POLLIN) > + if (!(pollfd[0].revents & POLLIN)) That's a bug fix. If revents was e.g. POLLPRI then this logic wouldn't have done what it's supposed to do. Maybe we should better call out that this is a fix in the summary and add a fixes tag? Anyway, Reviewed-by: Andrew Jones <drjones@redhat.com> Thanks, drew > continue; > > r = read(uffd, &msg, sizeof(msg)); > -- > 2.33.0.464.g1972c5931b-goog >
On 21/09/21 03:01, Oliver Upton wrote: > Building demand_paging_test.c with clang throws the following warning: > >>> demand_paging_test.c:182:7: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses] > if (!pollfd[0].revents & POLLIN) > > Silence the warning by placing the bitwise operation within parentheses. > > Signed-off-by: Oliver Upton <oupton@google.com> > --- > tools/testing/selftests/kvm/demand_paging_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c > index e79c1b64977f..10edae425ab3 100644 > --- a/tools/testing/selftests/kvm/demand_paging_test.c > +++ b/tools/testing/selftests/kvm/demand_paging_test.c > @@ -179,7 +179,7 @@ static void *uffd_handler_thread_fn(void *arg) > return NULL; > } > > - if (!pollfd[0].revents & POLLIN) > + if (!(pollfd[0].revents & POLLIN)) > continue; > > r = read(uffd, &msg, sizeof(msg)); > Queued (with small adjustments to the commit message and Cc: stable), thanks. Paolo
Hi Paolo, On Tue, Sep 21, 2021 at 10:38 AM Paolo Bonzini <pbonzini@redhat.com> wrote: > > On 21/09/21 03:01, Oliver Upton wrote: > > Building demand_paging_test.c with clang throws the following warning: > > > >>> demand_paging_test.c:182:7: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses] > > if (!pollfd[0].revents & POLLIN) > > > > Silence the warning by placing the bitwise operation within parentheses. > > > > Signed-off-by: Oliver Upton <oupton@google.com> > > --- > > tools/testing/selftests/kvm/demand_paging_test.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c > > index e79c1b64977f..10edae425ab3 100644 > > --- a/tools/testing/selftests/kvm/demand_paging_test.c > > +++ b/tools/testing/selftests/kvm/demand_paging_test.c > > @@ -179,7 +179,7 @@ static void *uffd_handler_thread_fn(void *arg) > > return NULL; > > } > > > > - if (!pollfd[0].revents & POLLIN) > > + if (!(pollfd[0].revents & POLLIN)) > > continue; > > > > r = read(uffd, &msg, sizeof(msg)); > > > > Queued (with small adjustments to the commit message and Cc: stable), > thanks. I sent out a v2 of this series that addressed Drew's comments here and picked up his suggested fix for 2/2. Would you like to queue that version instead? http://lore.kernel.org/kvm/20210921171121.2148982-1-oupton@google.com -- Thanks, Oliver
diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c index e79c1b64977f..10edae425ab3 100644 --- a/tools/testing/selftests/kvm/demand_paging_test.c +++ b/tools/testing/selftests/kvm/demand_paging_test.c @@ -179,7 +179,7 @@ static void *uffd_handler_thread_fn(void *arg) return NULL; } - if (!pollfd[0].revents & POLLIN) + if (!(pollfd[0].revents & POLLIN)) continue; r = read(uffd, &msg, sizeof(msg));