⬢ DragonFlyBSD Kernel Audit
DF-4662 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/ath/ath_hal/ar5212/ar2413.c
+++ b/sys/dev/netif/ath/ath_hal/ar5212/ar2413.c
@@ -455,8 +455,17 @@
 		}
 
 		sizeCurrVpdTable = Pmax_t2[ii] - Pmin_t2[ii];
 		tgtIndex = pPdGainBoundaries[ii] + pdGainOverlap_t2 - Pmin_t2[ii];
+		/*
+		 * A flat (or single-step) EEPROM power curve for this
+		 * pdGain makes sizeCurrVpdTable 0 (or 1); the reads
+		 * VpdTable_I[ii][sizeCurrVpdTable-1/-2] below wrap the
+		 * uint32 index to 0xFFFFFFFF/0xFFFFFFFE and read at
+		 * row + 0x1FFFFFFFE bytes.  Clamp to keep them in-row.
+		 */
+		if (sizeCurrVpdTable < 2)
+			sizeCurrVpdTable = 2;
 		maxIndex = (tgtIndex < sizeCurrVpdTable) ? tgtIndex : sizeCurrVpdTable;
 
 		while (ss < (int16_t)maxIndex)
 			pPDADCValues[kk++] = VpdTable_I[ii][ss++];