⬢ DragonFlyBSD Kernel Audit
DF-4923 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/netif/mii_layer/tlphy.c b/sys/dev/netif/mii_layer/tlphy.c
index 1111111..2222222 100644
--- a/sys/dev/netif/mii_layer/tlphy.c
+++ b/sys/dev/netif/mii_layer/tlphy.c
@@ -174,7 +174,10 @@ tlphy_attach(device_t dev)
 		device_get_children(sc->sc_mii.mii_dev, &devlist, &devs);
 		for (i = 0; i < devs; i++) {
-			if (strcmp(device_get_name(devlist[i]), "tlphy")) {
+			const char *dname = device_get_name(devlist[i]);
+
+			/* Children not yet probed have no devclass -> NULL name. */
+			if (dname != NULL && strcmp(dname, "tlphy") != 0) {
 				other = device_get_softc(devlist[i]);
 				capmask &= ~other->mii_capabilities;
 				break;