⬢ DragonFlyBSD Kernel Audit
DF-3977 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/ath/ath_hal/ar5212/ar5212_reset.c
+++ b/sys/dev/netif/ath/ath_hal/ar5212/ar5212_reset.c
@@ -2496,6 +2496,9 @@
 	uint16_t clo, chi, twiceMaxEdgePower;
 	int i, numEdges;
 
+	if (pRdEdgesPower[0].rdEdge == 0)	/* empty CTL: keep the cap */
+		return MAX_RATE_POWER;
+
 	/* Get the edge power */
 	for (i = 0; i < NUM_EDGES; i++) {
 		if (pRdEdgesPower[i].rdEdge == 0)
@@ -2575,6 +2578,9 @@
 	uint16_t clo, chi, ixlo, ixhi;
 	int i;
 
+	if (numChannels == 0)			/* empty pier list */
+		return;
+
 	/* Copy the target powers into the temp channel list */
 	for (i = 0; i < numChannels; i++)
 		tempChannelList[i] = powInfo[i].testChannel;
@@ -2630,6 +2636,11 @@
 	uint32_t target = v * EEP_SCALE;
 	uint16_t *ep = lp+listSize;
 
+	if (listSize == 0) {			/* defensive: empty list */
+		*vlo = *vhi = 0;
+		return;
+	}
+
 	*vlo = 0;	/* avoid gcc warnings */
 	*vhi = 0;	/* avoid gcc warnings */