[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [QEMU 1/1] nvme: Fix misleading macro when mixed with ternary operat
From: |
Klaus Jensen |
Subject: |
Re: [QEMU 1/1] nvme: Fix misleading macro when mixed with ternary operator |
Date: |
Tue, 12 Jul 2022 14:22:11 +0200 |
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>
signature.asc
Description: PGP signature