From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84EBCC433EF for ; Tue, 12 Jul 2022 12:24:40 +0000 (UTC) Received: from localhost ([::1]:51056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBEwR-0003wi-IR for qemu-devel@archiver.kernel.org; Tue, 12 Jul 2022 08:24:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBEuF-0001kS-TJ; Tue, 12 Jul 2022 08:22:24 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:55463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBEuA-0004lp-Ob; Tue, 12 Jul 2022 08:22:21 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5BF965C0067; Tue, 12 Jul 2022 08:22:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 12 Jul 2022 08:22:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1657628536; x=1657714936; bh=HV kxoQGf904cze7sglZBeurLOBqEha/6moItBO7y3bU=; b=Q1js20GvVByD3P7yB7 FY3vETauu+fBZZW+9H6RDp7pec+kFQIedVMhDqYoIBWbqjG8K3SQR43j5IDhvD95 GqCkZ8cA2MXMw20n0QJlTce38BcyB0ngqzmOYCWURNm6Pbue+kDPtwy/jvbw0FYK r7AugeRXYkrFFFuabfEk0Qo7k/v3hjjbIEA9HY21AjLHkZvxl7mGcnvcI4J7fdQq Tohfbe6OxRudFpQmNqbTg/sTZi/hRsI/NDncJS0bKtI6SSNCNXVx0EHQuADtWyX0 pcl0xyzfKGKmnOr2cv7dlSQxkSKwV1ard8P3Dmp44UMj5Eai9eU0hR2GU+yKKDqx hm5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1657628536; x=1657714936; bh=HVkxoQGf904cze7sglZBeurLOBqE ha/6moItBO7y3bU=; b=linb8fTp2jzFLm0ZhGaqPIXree0e5HM2r2nluQCKCYDP yTBibCJCo3iHDUbNUDk9czXL69z8BamuJdnol87jbEwEhn17Pyb6+AyKV0kHJPHI xXUl/BoVYQxsZs4OA7Rz/54iJTRqyLpwjQ/tA4ehw9TsH/77TeOFwF4beo7/EZKt sO/oTWOgk18dgdmkwikhOv/SKSb8seA0t5IRXVbhAfIN7BgydJ0r2zpTbiO2q7Au 1foV3/nsexcTzKsN74I12n1hBaUgCck9KzsQhNR59hJCuVub4udg0uHEIO+8qgUA yxXigz3nTT9dmmnOuHjTGZfWdDscy67G8ODwTyuyEw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudejhedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepmfhlrghu shculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrth htvghrnhepjefgjeefffdvuefhieefhffggfeuleehudekveejvedtuddugeeigeetffff jeevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih htshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Jul 2022 08:22:13 -0400 (EDT) Date: Tue, 12 Jul 2022 14:22:11 +0200 From: Klaus Jensen To: Stefan Hajnoczi Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Hanna Reitz , Kevin Wolf , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Fam Zheng , Keith Busch , darren.kenny@oracle.com Subject: Re: [QEMU 1/1] nvme: Fix misleading macro when mixed with ternary operator Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WJRB15Ft9CQPgZt+" Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=66.111.4.28; envelope-from=its@irrelevant.dk; helo=out4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --WJRB15Ft9CQPgZt+ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: > >=20 > > x ? a: b & FLAG_TEST > >=20 > > which will result in a different result to: > >=20 > > (x ? a: b) & FLAG_TEST. > >=20 > > The macros should wrap each of the parameters in brackets to ensure the > > correct result on expansion. > >=20 > > Signed-off-by: Darren Kenny > > --- > > include/block/nvme.h | 44 ++++++++++++++++++++++---------------------- > > 1 file changed, 22 insertions(+), 22 deletions(-) >=20 > Klaus: ping >=20 > Reviewed-by: Stefan Hajnoczi Sorry, Thanks Darren, applied to nvme-next! Reviewed-by: Klaus Jensen --WJRB15Ft9CQPgZt+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmLNZ28ACgkQTeGvMW1P DemXoAf+KsGV4q4UFkSnBviPwt2mAgApOREr3RexU8cM1X3n1A4hZZRRJAWkZjwk OH2X/FpgYVUkw47/QW13GKKv1ZWw+R1U4yjqoFt4N8+EeILzyt4m4VfBMBJlLn7I uz0JjEd8WG1LSIkUbM8ws7bwCjqsl/jwCrKFzgmAYuum9U7v5goqMFguFf0nsn3Q wQXXfx8q7az+xDDpp+9JEXLqdzp9B7Ve3OJ8s3EfDDeEg7P0HBwKfIFIxnnxGpIV 0ptQTt7PBJLG93KPvNPGJxbf58Gzy9UbnbBhN9ST/TwQ91GOiwrIZc7PSrI2ikrp sjgtExClVfxDPtvwubSLzMbwnPr4aA== =vKL4 -----END PGP SIGNATURE----- --WJRB15Ft9CQPgZt+--