git: 049b3c953e1e - stable/14 - bhyve: avoid side effect in assertion

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Mon, 17 Jun 2024 04:03:26 UTC
The branch stable/14 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=049b3c953e1eb81851c8668092beda377c3dbf0b

commit 049b3c953e1eb81851c8668092beda377c3dbf0b
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2024-05-17 07:31:32 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-06-17 03:58:35 +0000

    bhyve: avoid side effect in assertion
    
    An assert() was setting the error variable instead of checking it.
    
    Reported by:    Coverity Scan
    CID:            1521431
    Reviewed by:    jhb
    Sponsored by:   The FreeBSD Foundation
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1244
    
    (cherry picked from commit f7d45c5443edc99857fdda19c68301b5ec4a8971)
---
 usr.sbin/bhyve/tpm_ppi_qemu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/tpm_ppi_qemu.c b/usr.sbin/bhyve/tpm_ppi_qemu.c
index 8bea45ea3208..da0edf84798f 100644
--- a/usr.sbin/bhyve/tpm_ppi_qemu.c
+++ b/usr.sbin/bhyve/tpm_ppi_qemu.c
@@ -162,7 +162,7 @@ tpm_ppi_deinit(void *sc)
 	ppi = sc;
 
 	error = unregister_mem(&ppi_mmio);
-	assert(error = 0);
+	assert(error == 0);
 
 	free(ppi);
 }