qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Klaus Jensen <its@irrelevant.dk>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Fam Zheng" <fam@euphon.net>, "Keith Busch" <kbusch@kernel.org>,
	darren.kenny@oracle.com
Subject: Re: [QEMU 1/1] nvme: Fix misleading macro when mixed with ternary operator
Date: Tue, 12 Jul 2022 14:22:11 +0200	[thread overview]
Message-ID: <Ys1nc+eAyghckfIe@apples> (raw)
In-Reply-To: <Ys1k6ameYujtE1TX@stefanha-x1.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

On Jul 12 13:11, Stefan Hajnoczi wrote:
> On Thu, Jul 07, 2022 at 01:36:21PM +0000, Darren Kenny wrote:
> > Using the Parfait source code analyser and issue was found in
> > hw/nvme/ctrl.c where the macros NVME_CAP_SET_CMBS and NVME_CAP_SET_PMRS
> > are called with a ternary operatore in the second parameter, resulting
> > in a potentially unexpected expansion of the form:
> > 
> >   x ? a: b & FLAG_TEST
> > 
> > which will result in a different result to:
> > 
> >   (x ? a: b) & FLAG_TEST.
> > 
> > The macros should wrap each of the parameters in brackets to ensure the
> > correct result on expansion.
> > 
> > Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
> > ---
> >  include/block/nvme.h | 44 ++++++++++++++++++++++----------------------
> >  1 file changed, 22 insertions(+), 22 deletions(-)
> 
> Klaus: ping
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Sorry,

Thanks Darren, applied to nvme-next!

Reviewed-by: Klaus Jensen <k.jensen@samsung.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2022-07-12 12:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 13:36 [QEMU 1/1] nvme: Fix misleading macro when mixed with ternary operator Darren Kenny
2022-07-12 12:11 ` Stefan Hajnoczi
2022-07-12 12:22   ` Klaus Jensen [this message]

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=Ys1nc+eAyghckfIe@apples \
    --to=its@irrelevant.dk \
    --cc=darren.kenny@oracle.com \
    --cc=f4bug@amsat.org \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).