git: b252fb24301c - main - bhyve: ahci: Fix regression with no ports
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 21 Jan 2022 13:00:13 UTC
The branch main has been updated by freqlabs:
URL: https://cgit.FreeBSD.org/src/commit/?id=b252fb24301c1f7e7d83eab631e7d9fa947e227d
commit b252fb24301c1f7e7d83eab631e7d9fa947e227d
Author: Ryan Moeller <freqlabs@FreeBSD.org>
AuthorDate: 2022-01-21 12:59:25 +0000
Commit: Ryan Moeller <freqlabs@FreeBSD.org>
CommitDate: 2022-01-21 12:59:25 +0000
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
---
usr.sbin/bhyve/pci_ahci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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];