git: 469a4e669d87 - stable/13 - bhyve: avoid an empty passthru config value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 May 2022 15:24:40 UTC
The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=469a4e669d87cd01c7aae1917c55f2dc9910c4b3 commit 469a4e669d87cd01c7aae1917c55f2dc9910c4b3 Author: Corvin Köhne <CorvinK@beckhoff.com> AuthorDate: 2022-04-01 08:20:55 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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