From nobody Sat May 18 01:24:39 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vh5jC5g0hz5Kl6Q; Sat, 18 May 2024 01:24:47 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vh5jC3H4wz4ptg; Sat, 18 May 2024 01:24:47 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715995487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7qls1BulOE7j/5ZZ44tM8ioDm/g4kiV6fhjeO+vCTA8=; b=ai2hUMfBTdsQtDuVykrNT4ewCGGQTD2lrzV/orW02TWWccNaJ1A79avqEjDlBd0DndbFzE mQztF1muWmJPIsAGXslyEKaqZyC8+JBPW2HzaPjJxgCojo3zfagX5rZIoiXUEKE+unlJDq YnIFcEKAEibUHc2uYBwtD853lE/IGP17qYQOwdwlIyVJgI4yQXQo/BeehE4z+yIgsjTuuH mlb1m7ZbHHy2DOM/NkvT9+bMhjW82I5AF5Tmc517xwZ8wgvzhmA9sL/WEkvPQpznD3ik63 DnsgYWovDG4pw7uh4reWMprgdvOCARYVevZOzlyrnlylZ4ypLoQjrNs35ZCcuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715995487; a=rsa-sha256; cv=none; b=vz4dxznDcB360L0i0efvQJuJY/Tmo15eOrnGkRlonFnJoLl4W5ERh28sKexFEd3ZTOpaAq ZNj0KVOHtbbzrgg3yzetR+bGWqdhpsPuac91idtVHN5621Nm4gjnEzoUsUlBWg1l8+inaQ FG97nKgInBeNzpkaxOAtltdMC95s40lua1XItXyT7Gq2FZlbXHLC5F2FCynebK5E72qNES S+D7Gkl//CB1wBVJb2JBWK3UXVina44ZoiUEKIw0UT/JWpf8zUYN1zoXbTUxtASwmlNdI6 qpRHXCz4qVMu8MuWpnlwl6km3MXgmn4nsl8StGTPStg/AHGR3NDBwTgwLK8KYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715995487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7qls1BulOE7j/5ZZ44tM8ioDm/g4kiV6fhjeO+vCTA8=; b=M39vDvUMg4xnZha/F60y2SoQsUKH0fkjJzwfe9XBp7oGsaBErab9WMdrfRQCHTuObCiipt ej19IFeupOAzIlv5PGlI3Ab1s1SsrT6gFV7jbRFBBfg9ExoUKf3bxPR+hxaYcygJPy2YOA vQjTy+5F8HgmMW9x306EzzaBAewCTYqpzEGc3eO7EURrNnQIEyctjIBR8FAfY9gKPa9pjN 7rC7H3t8fbS0N6MwHwS4d1jJmq/OA9KVSG7QaUOmKuPSXqjEK6peHliQDFPfASLWian1Z3 6mDVg0F8YDemOS8w6CYjazSjAH6JkH3OLQDiKWJDFASyq4e2i47mmn8qWiHdvw== Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Vh5jB0LkvzTKw; Sat, 18 May 2024 01:24:45 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Content-Type: text/plain; charset=us-ascii List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: git: f7d45c5443ed - main - bhyve: avoid side effect in assertion From: Zhenlei Huang In-Reply-To: Date: Sat, 18 May 2024 09:24:39 +0800 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <87605178-E3BF-4B48-B1D9-2D54EE2FADA7@FreeBSD.org> References: <202405172000.44HK0Xw3049841@gitrepo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3696.120.41.1.8) > On May 18, 2024, at 8:57 AM, Zhenlei Huang wrote: >=20 >=20 >=20 >> On May 18, 2024, at 4:00 AM, Ed Maste wrote: >>=20 >> The branch main has been updated by emaste: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df7d45c5443edc99857fdda19c68301b5= ec4a8971 >>=20 >> commit f7d45c5443edc99857fdda19c68301b5ec4a8971 >> Author: Pierre Pronchery >> AuthorDate: 2024-05-17 07:31:32 +0000 >> Commit: Ed Maste >> CommitDate: 2024-05-17 19:45:18 +0000 >>=20 >> bhyve: avoid side effect in assertion >>=20 >> An assert() was setting the error variable instead of checking it. >>=20 >> Reported by: Coverity Scan >> CID: 1521431 >> Reviewed by: jhb >> Sponsored by: The FreeBSD Foundation >> Pull Request: https://github.com/freebsd/freebsd-src/pull/1244 >> --- >> usr.sbin/bhyve/tpm_ppi_qemu.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/usr.sbin/bhyve/tpm_ppi_qemu.c = b/usr.sbin/bhyve/tpm_ppi_qemu.c >> index ad66ecb09683..239d39184589 100644 >> --- a/usr.sbin/bhyve/tpm_ppi_qemu.c >> +++ b/usr.sbin/bhyve/tpm_ppi_qemu.c >> @@ -161,7 +161,7 @@ tpm_ppi_deinit(void *sc) >> ppi =3D sc; >>=20 >> error =3D unregister_mem(&ppi_mmio); >> - assert(error =3D 0); >> + assert(error =3D=3D 0); >=20 > Emm, does that not get caught by compilers ? Unfortunately not. assert is defined as a macro as such ``` #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) ``` So `e` is enclosed with () and compiler can not catch that. >=20 >>=20 >> free(ppi); >> } >=20 >=20 >=20