The branch main has been updated by manu:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3256b7ca36e739a08f141a7ee52b9db9d995db85

commit 3256b7ca36e739a08f141a7ee52b9db9d995db85
Author:     Corvin Köhne <[email protected]>
AuthorDate: 2022-04-01 08:20:55 +0000
Commit:     Emmanuel Vadot <[email protected]>
CommitDate: 2022-04-01 09:13:16 +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
---
 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 3cb0649f4741..153554f97e43 100644
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -662,7 +662,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

Reply via email to