Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kDOTa-000517-3D for mharc-qemu-trivial@gnu.org; Wed, 02 Sep 2020 04:50:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDOTX-0004zT-S5; Wed, 02 Sep 2020 04:50:39 -0400 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:60475) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDOTW-0007jZ-0V; Wed, 02 Sep 2020 04:50:39 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.55]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id B1AE6568B810; Wed, 2 Sep 2020 10:50:14 +0200 (CEST) Received: from kaod.org (37.59.142.100) by DAG8EX1.mxp5.local (172.16.2.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Wed, 2 Sep 2020 10:50:14 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-100R0037a3a12a2-ac41-453b-9280-6142c8ea2032, AA3809B24A0F88596FE87CA7447536A9393A4537) smtp.auth=groug@kaod.org Date: Wed, 2 Sep 2020 10:50:13 +0200 From: Greg Kurz To: Philippe =?UTF-8?B?TWF0aGlldS1EYXVkw6k=?= CC: , Laurent Vivier , Thomas Huth , Corey Minyard , "Michael S. Tsirkin" , , , "Paolo Bonzini" , David Gibson , Richard Henderson Subject: Re: [PATCH 1/5] tests/qtest/ipmi-kcs: Fix assert side-effect Message-ID: <20200902105013.75819844@bahia.lan> In-Reply-To: <20200902080801.160652-2-philmd@redhat.com> References: <20200902080801.160652-1-philmd@redhat.com> <20200902080801.160652-2-philmd@redhat.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG3EX2.mxp5.local (172.16.2.22) To DAG8EX1.mxp5.local (172.16.2.71) X-Ovh-Tracer-GUID: f9ca1c06-83f3-4f23-8859-dd0da03ddde7 X-Ovh-Tracer-Id: 6685030699115387381 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedrudefledgtdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffukfgjfhfogggtgfhisehtqheftdertdejnecuhfhrohhmpefirhgvghcumfhurhiiuceoghhrohhugheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeelueetheegheefteevveelvdfhueeuudegudegtedufeeutdekkeeugeejgfetvdenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepghhrohhugheskhgrohgurdhorhhgpdhrtghpthhtoheprhhthhesthifihguughlvgdrnhgvth Received-SPF: pass client-ip=178.32.125.2; envelope-from=groug@kaod.org; helo=smtpout1.mo529.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 04:50:35 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2020 08:50:40 -0000 On Wed, 2 Sep 2020 10:07:57 +0200 Philippe Mathieu-Daud=C3=A9 wrote: > Fix assert side-effect reported by Coverity: >=20 > /qemu/tests/qtest/ipmi-kcs-test.c: 84 in kcs_wait_obf() > 83 while (IPMI_KCS_CMDREG_GET_OBF() =3D=3D 0) { > >>> CID 1432368: Incorrect expression (ASSERT_SIDE_EFFECT) > >>> Argument "--count" of g_assert() has a side effect. The contai= ning function might work differently in a non-debug build. > 84 g_assert(--count !=3D 0); >=20 > Reported-by: Coverity (CID 1432368) > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- Reviewed-by: Greg Kurz > tests/qtest/ipmi-kcs-test.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/tests/qtest/ipmi-kcs-test.c b/tests/qtest/ipmi-kcs-test.c > index 693a6aacb52..fc0a918c8d1 100644 > --- a/tests/qtest/ipmi-kcs-test.c > +++ b/tests/qtest/ipmi-kcs-test.c > @@ -81,7 +81,8 @@ static void kcs_wait_obf(void) > { > unsigned int count =3D 1000; > while (IPMI_KCS_CMDREG_GET_OBF() =3D=3D 0) { > - g_assert(--count !=3D 0); > + --count; > + g_assert(count !=3D 0); > } > } > =20