From nobody Mon May 16 15:24:40 2022 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 34E4F1AE353F; Mon, 16 May 2022 15:24:41 +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 4L232d0zL6z3ncl; Mon, 16 May 2022 15:24:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652714681; 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=2YbZxZAVx7SXaxTlPA6GyLNLy9ezhq1DyakDVsQM2ww=; b=FWfr1BW2ZoM4faYZOnHxBs1v7qdtFr93JFrehXJdcfV61lJl3q8MlflehMZ4PXxtixVbP2 KAaeKbHMRlAMsC4qUlxZ3xlTuLp/4FthoEYmXfUjYQ89f6NvHUWijcnpskyzB0sNepCUV+ IQruxlJk1ebdnHyENX9ZKY/jqdTC3fmV89dUGvlnd8e0PJ+ArjRGZUQIL4Xs1C7Ydr2e98 EDqB9vHNbGQAaa62qUzp5P8G3smPKZwvTVfy2MU+7vmhUKTIaULc/xsk4TsJNKY1Be8Om0 I8PVK0EvQrmtp29lYTf+N/SHo5TOm3ij7KGoYwqMGXqnpQyF7w8KZbUfsQJ2SA== 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 015762207B; Mon, 16 May 2022 15:24:41 +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 24GFOejY006581; Mon, 16 May 2022 15:24:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24GFOeK5006580; Mon, 16 May 2022 15:24:40 GMT (envelope-from git) Date: Mon, 16 May 2022 15:24:40 GMT Message-Id: <202205161524.24GFOeK5006580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 469a4e669d87 - stable/13 - bhyve: avoid an empty passthru config value 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: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 469a4e669d87cd01c7aae1917c55f2dc9910c4b3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652714681; 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=2YbZxZAVx7SXaxTlPA6GyLNLy9ezhq1DyakDVsQM2ww=; b=kSdRD9oqefCfjSyuPt/uKg77FyKDrjbss+COdD4W94UgOPwfwsiilhvGz23fK1r48Mqt31 twNiVsXDTjgbooju5zLvMhc9yBxigS2NgvfVsvD6kjXo9LSHEhnx78HWBJ0QbGroU1R/NU pS0QJGUwimo+blpDe4Dn7P0/qlcrPQkEeII1EA8yHXD7htoCAk/eCcfnMRul7qYcAvVclb rKNFZ/bo3RUyjuGyErDl8Wt26GecQHab+9kbSSvkLwbITV06713beu0Q/iLrFGJoZ+g+lQ VmsonynEVOL1Mc7g3TUHsbYjqSD/WaABd3TMHClmHsCC4r1pXkM0Rh24fhxC4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652714681; a=rsa-sha256; cv=none; b=hXm0qukhCt8beCTlpWDTq41lKIZZn/tne33oxHmFPbgKX1G9edxvU4o7yb43a5HuKrIiTr CUMRd5vxFOAQIYd0+vQnh7oq4pbEvi35GiL7E2SigNNar6XXsJH+zofEyonRjj1J9VYA5w 8vhLEPJ52ZTgxzltZ7Y1E7pDqdaAyyxAygIQ6muCjwgQgJHHvkJBb4sUFnEXu1IsGRKwyp 1h7MWb3Rrj99AHWB7TStedzPCq+N3nx16RU8BNOujRLjDT6JaS7Ox2l9acRpN9C0ow/Iqp rkxeHgtS+/x7xUHMRpeL7I6CPTJM4p/NErDaHPQ/1A9GjQRG6LmOjwjR+RDE9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=469a4e669d87cd01c7aae1917c55f2dc9910c4b3 commit 469a4e669d87cd01c7aae1917c55f2dc9910c4b3 Author: Corvin Köhne AuthorDate: 2022-04-01 08:20:55 +0000 Commit: Emmanuel Vadot CommitDate: 2022-05-16 15:24:33 +0000 bhyve: avoid an empty passthru config value pci_parse_legacy_config splits the options string by comma characters. strchr returns a pointer to the first occurence of a character. In that case, it's a comma. So, pci_parse_legacy_config will stop at the first character and creates a new config node with a name of NULL. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D34600 (cherry picked from commit 3256b7ca36e739a08f141a7ee52b9db9d995db85) --- usr.sbin/bhyve/pci_passthru.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index 56f049a6d312..7817274a3541 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -669,7 +669,12 @@ passthru_legacy_config(nvlist_t *nvl, const char *opts) snprintf(value, sizeof(value), "%d", func); set_config_value_node(nvl, "func", value); - return (pci_parse_legacy_config(nvl, strchr(opts, ','))); + opts = strchr(opts, ','); + if (opts == NULL) { + return (0); + } + + return pci_parse_legacy_config(nvl, opts + 1); } static int