From: Alex Williamson <alex.williamson@redhat.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
nipun.gupta@amd.com, nikhil.agarwal@amd.com,
ndesaulniers@google.com, trix@redhat.com, shubham.rohila@amd.com,
kvm@vger.kernel.org, llvm@lists.linux.dev,
patches@lists.linux.dev
Subject: Re: [PATCH] vfio/cdx: Add parentheses between bitwise AND expression and logical NOT
Date: Tue, 3 Oct 2023 11:20:19 -0600 [thread overview]
Message-ID: <20231003112019.4b067e45.alex.williamson@redhat.com> (raw)
In-Reply-To: <20231003152739.GB63187@dev-arch.thelio-3990X>
On Tue, 3 Oct 2023 08:27:39 -0700
Nathan Chancellor <nathan@kernel.org> wrote:
> On Tue, Oct 03, 2023 at 09:40:02AM +0200, Philippe Mathieu-Daudé wrote:
> > Hi Nathan,
> >
> > On 2/10/23 19:53, Nathan Chancellor wrote:
> > > When building with clang, there is a warning (or error with
> > > CONFIG_WERROR=y) due to a bitwise AND and logical NOT in
> > > vfio_cdx_bm_ctrl():
> > >
> > > drivers/vfio/cdx/main.c:77:6: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses]
> > > 77 | if (!vdev->flags & BME_SUPPORT)
> > > | ^ ~
> > > drivers/vfio/cdx/main.c:77:6: note: add parentheses after the '!' to evaluate the bitwise operator first
> > > 77 | if (!vdev->flags & BME_SUPPORT)
> > > | ^
> > > | ( )
> > > drivers/vfio/cdx/main.c:77:6: note: add parentheses around left hand side expression to silence this warning
> > > 77 | if (!vdev->flags & BME_SUPPORT)
> > > | ^
> > > | ( )
> > > 1 error generated.
> > >
> > > Add the parentheses as suggested in the first note, which is clearly
> > > what was intended here.
> > >
> > > Closes: https://github.com/ClangBuiltLinux/linux/issues/1939
> > > Fixes: 8a97ab9b8b31 ("vfio-cdx: add bus mastering device feature support")
> >
> > My current /master points to commit ce36c8b14987 which doesn't include
> > 8a97ab9b8b31, so maybe this can be squashed / reordered in the VFIO tree
> > (where I assume this commit is). That said, the fix is correct, so:
>
> Yes, this is a -next only issue at the moment and I don't mind this
> change being squashed into the original if Alex rebases his tree (some
> maintainers don't).
Right, where practical we try not to change commit hashes once
something has been included into linux-next, preferring to layer fixes
or even reverts, but occasionally something will come up where it makes
sense to rebase. This is not such a case :) Thanks,
Alex
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Thanks a lot for taking a look!
>
> Cheers,
> Nathan
>
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > > ---
> > > drivers/vfio/cdx/main.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vfio/cdx/main.c b/drivers/vfio/cdx/main.c
> > > index a437630be354..a63744302b5e 100644
> > > --- a/drivers/vfio/cdx/main.c
> > > +++ b/drivers/vfio/cdx/main.c
> > > @@ -74,7 +74,7 @@ static int vfio_cdx_bm_ctrl(struct vfio_device *core_vdev, u32 flags,
> > > struct vfio_device_feature_bus_master ops;
> > > int ret;
> > > - if (!vdev->flags & BME_SUPPORT)
> > > + if (!(vdev->flags & BME_SUPPORT))
> > > return -ENOTTY;
> > > ret = vfio_check_feature(flags, argsz, VFIO_DEVICE_FEATURE_SET,
> > >
> > > ---
> > > base-commit: fcb2f2ed4a80cfe383d87da75caba958516507e9
> > > change-id: 20231002-vfio-cdx-logical-not-parentheses-aca8fbd6b278
> > >
> > > Best regards,
> >
>
next prev parent reply other threads:[~2023-10-03 17:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 17:53 [PATCH] vfio/cdx: Add parentheses between bitwise AND expression and logical NOT Nathan Chancellor
2023-10-02 17:57 ` Nick Desaulniers
2023-10-03 4:17 ` Agarwal, Nikhil
2023-10-03 7:40 ` Philippe Mathieu-Daudé
2023-10-03 15:27 ` Nathan Chancellor
2023-10-03 17:20 ` Alex Williamson [this message]
2023-10-04 6:48 ` Philippe Mathieu-Daudé
2023-10-03 18:01 ` Alex Williamson
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=20231003112019.4b067e45.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nikhil.agarwal@amd.com \
--cc=nipun.gupta@amd.com \
--cc=patches@lists.linux.dev \
--cc=philmd@linaro.org \
--cc=shubham.rohila@amd.com \
--cc=trix@redhat.com \
/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).