⬢ DragonFlyBSD Kernel Audit
DF-4997 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/ral/rt2860var.h	2026-09-25 17:49:54.151891734 +0000
+++ b/sys/dev/netif/ral/rt2860var.h	2026-09-25 17:49:54.179891372 +0000
@@ -116,18 +116,19 @@
 
 struct rt2860_softc {
 	struct ieee80211com		sc_ic;
-	struct mbufq			sc_snd;
 #if defined(__DragonFly__)
 	struct lock			sc_mtx;
 #else
 	struct mtx			sc_mtx;
 #endif
+	struct mbufq			sc_snd;
 	device_t			sc_dev;
 	bus_space_tag_t			sc_st;
 	bus_space_handle_t		sc_sh;
 
 	struct callout			watchdog_ch;
 
+	int				sc_tx_timer;
 	int				sc_invalid;
 	int				sc_debug;
 /*
@@ -157,7 +158,6 @@
 	bus_dma_segment_t		txwi_seg;
 	caddr_t				txwi_vaddr;
 
-	int				sc_tx_timer;
 	int				mgtqid;
 	uint8_t				qfullmsk;
 
--- a/sys/dev/netif/ral/if_ral_pci.c	2026-09-25 17:49:54.151891734 +0000
+++ b/sys/dev/netif/ral/if_ral_pci.c	2026-09-25 17:49:54.183891319 +0000
@@ -56,6 +56,21 @@
 #include <dev/netif/ral/rt2661var.h>
 #include <dev/netif/ral/rt2860var.h>
 
+/*
+ * The PCI glue touches the child softcs through the rt2560 union alias
+ * (psc->u.sc_rt2560).  Fail the build if any aliased field drifts.
+ */
+CTASSERT(__offsetof(struct rt2560_softc, sc_st) ==
+	__offsetof(struct rt2661_softc, sc_st));
+CTASSERT(__offsetof(struct rt2560_softc, sc_st) ==
+	__offsetof(struct rt2860_softc, sc_st));
+CTASSERT(__offsetof(struct rt2560_softc, sc_sh) ==
+	__offsetof(struct rt2860_softc, sc_sh));
+CTASSERT(__offsetof(struct rt2560_softc, sc_invalid) ==
+	__offsetof(struct rt2661_softc, sc_invalid));
+CTASSERT(__offsetof(struct rt2560_softc, sc_invalid) ==
+	__offsetof(struct rt2860_softc, sc_invalid));
+
 MODULE_DEPEND(ral, pci, 1, 1, 1);
 MODULE_DEPEND(ral, firmware, 1, 1, 1);
 MODULE_DEPEND(ral, wlan, 1, 1, 1);