From nobody Fri Jun 16 06:23:01 2023 X-Original-To: dev-commits-src-all@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 4Qj8Gt0Wgyz4fJw6; Fri, 16 Jun 2023 06:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qj8Gt04Z3z3w0B; Fri, 16 Jun 2023 06:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686896582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vXSNu0YUtrmGXn7n9NyA+YCRumpyxxr074mQOYWjdXc=; b=xt+DUvdc5PBTc/I5eJuN7EMnYfI7il8nzQlV2uI0vZVaEQgCV5hHtkR0dbriUollfrYEn8 O7AoOwOB0nZ73L+Qzlyn+MftckCTFBU4e312Str0yOaC/tkBd3AU8qcJoD+/XSzi1eG0nw KSMz7rFV0kudreGYgnpfNexA5m58MiEFhu1C/O9Xa9qIJY9DO+aZkH8jRx16qA+SOMtUxl +yfB6Hzssoq4FbhOiFzjQgG8YEXPEUttOEOwEI8xFuTrZj4zF9RA2alkP9EREZguRWPA0z ZtOtXFG/wvhnSIyLV/MT2ITm9e+TZJvLiP4tvhL2KB88UquAZ0gvcdIpvnOU8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686896582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vXSNu0YUtrmGXn7n9NyA+YCRumpyxxr074mQOYWjdXc=; b=b/bom2bm6G6xS4WE0ZVpq5tLX9pm7NnVKiT5PbzYiN/eJBtNZ2Eakpao7CHmKcRb9oXLHA n9QwHgzjg8VpEu7nEdRaJ6atgs/PAWE0KT6IrxWHSCZeQEHwpZiqmLmPP+EQOHMitJ+k7q 1nImSCqQcZmcRRtG4SxkOeSaXPnJXFODzNcD6wLuwJ28tgR87n+7qc/H8uXFeh0haXUkAT dtQ49V3VeVAdI4VJlj3VUfSlH4XuSHHi9sN32JD5g4PQmEDTKb4CwCwFIBqSBN0+iKs2Hx vh5FC2HqtP/KdrgBU/AXlQQkh7ftENL3/6tSSeCOtgmmdQ5BVSke+W3xsGkgiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686896582; a=rsa-sha256; cv=none; b=K//cTD2EDdKGnvdpXFCKVujtTHVp2x3xcfv41gotBBwoWhC/1rMp1MHlIRl8nsK018U5XX iH5XVM5ZIAl4p4/Lc0gm/t38E08jhz3mLaw1A0vKwiW73xl8o4Pv2JR4OZ54+YvM40DcTx lDb+tfI9CaON/VV/4iKH/1yToCieWSQXSL1wECIScLOMjw+KPVZizzu9ECf2hOcR/6/42I Sy+eAtHW/7OlMV3iVX0cBL422j74gCH0c3gqWdlyP96j1+s2p2bDxsgQ3xF5W7X/La9R5f lxPnbnnUDQXtUCMQQ60XxJM5H2LYvnNYBnB4jQULXVKz3VwigRXy6iEMrzoCWA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qj8Gs6H8WzHq0; Fri, 16 Jun 2023 06:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35G6N1vZ051579; Fri, 16 Jun 2023 06:23:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35G6N1Ma051578; Fri, 16 Jun 2023 06:23:01 GMT (envelope-from git) Date: Fri, 16 Jun 2023 06:23:01 GMT Message-Id: <202306160623.35G6N1Ma051578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: b3564c233749 - main - bhyve: use assert for missing TPM version List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b3564c2337490f40747198dae3206459fa186ac1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=b3564c2337490f40747198dae3206459fa186ac1 commit b3564c2337490f40747198dae3206459fa186ac1 Author: Corvin Köhne AuthorDate: 2023-06-15 08:36:37 +0000 Commit: Corvin Köhne CommitDate: 2023-06-16 06:18:08 +0000 bhyve: use assert for missing TPM version The TPM version config node should always be set. If it's not set, there's a bug in our code. An assertion is the correct way to check for this. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D40558 --- usr.sbin/bhyve/tpm_device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/tpm_device.c b/usr.sbin/bhyve/tpm_device.c index 56df6ab0e30c..e48f9df14701 100644 --- a/usr.sbin/bhyve/tpm_device.c +++ b/usr.sbin/bhyve/tpm_device.c @@ -7,6 +7,7 @@ #include +#include #include #include #include @@ -54,7 +55,8 @@ tpm_device_create(struct tpm_device **const new_dev, struct vmctx *const vm_ctx, } value = get_config_value_node(nvl, "version"); - if (value == NULL || strcmp(value, "2.0")) { + assert(value != NULL); + if (strcmp(value, "2.0")) { warnx("%s: unsupported tpm version %s", __func__, value); error = EINVAL; goto err_out;