git: 51ce77b26157 - stable/13 - bhyve: ahci: Fix regression with no ports
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 28 Jan 2022 14:33:30 UTC
The branch stable/13 has been updated by freqlabs:
URL: https://cgit.FreeBSD.org/src/commit/?id=51ce77b261575890d3cecb7529357608b7972ac4
commit 51ce77b261575890d3cecb7529357608b7972ac4
Author: Ryan Moeller <freqlabs@FreeBSD.org>
AuthorDate: 2022-01-21 12:59:25 +0000
Commit: Ryan Moeller <freqlabs@FreeBSD.org>
CommitDate: 2022-01-28 14:32:31 +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
(cherry picked from commit b252fb24301c1f7e7d83eab631e7d9fa947e227d)
---
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 38ec87c34eed..7f7259abfe66 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];