aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Moeller <freqlabs@FreeBSD.org>2022-01-21 12:59:25 +0000
committerRyan Moeller <freqlabs@FreeBSD.org>2022-01-21 12:59:25 +0000
commitb252fb24301c1f7e7d83eab631e7d9fa947e227d (patch)
tree0fce75aaff7c232a16fbc5595a2087688bb10670
parenteb815a7419409056c65eb027c2b24b4e616480e8 (diff)
downloadsrc-b252fb24301c1f7e7d83eab631e7d9fa947e227d.tar.gz
src-b252fb24301c1f7e7d83eab631e7d9fa947e227d.zip
bhyve: ahci: Fix regression with no ports
An AHCI controller may be specified with no connected ports. Avoid dumping core in this case for compatibility with existing VM configs. Reviewed by: khng, jhb Fixes: 621b5090487de Refactor configuration management in bhyve. MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D33969
-rw-r--r--usr.sbin/bhyve/pci_ahci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c
index 316fbcf0f18d..d07b1f085e3d 100644
--- a/usr.sbin/bhyve/pci_ahci.c
+++ b/usr.sbin/bhyve/pci_ahci.c
@@ -2440,7 +2440,7 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl)
slots = 32;
ports_nvl = find_relative_config_node(nvl, "port");
- for (p = 0; p < MAX_PORTS; p++) {
+ for (p = 0; ports_nvl != NULL && p < MAX_PORTS; p++) {
struct ata_params *ata_ident = &sc->port[p].ata_ident;
char ident[AHCI_PORT_IDENT];