⬢ DragonFlyBSD Kernel Audit
DF-2258 / fix.diff
← back to finding ↓ download raw
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_paprd.c	2026-10-21 04:27:18.859407325 +0000
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_paprd.c	2026-10-21 04:27:18.875407119 +0000
@@ -1,3 +1,11 @@
         /*printf("gain_index = %d\n", gain_index);*/
         /*ath_hal_printf(ah, "++++ gain_index = %d\n", gain_index);*/
+        /* DF-2258: if every entry of paprd_gain_table_index[] is below
+         * desired_gain the loop above leaves gain_index == 32, and
+         * ar9300_tx_force_gain() then reads paprd_gain_table_entries[32]
+         * -- one past the array (aliases paprd_gain_table_index[0]).
+         * Clamp to the last valid entry. */
+        if (gain_index >= 32) {
+            gain_index = 31;
+        }
         ar9300_tx_force_gain(ah, gain_index);
\ No newline at end of file