Browse Source

[ath9k] Fix buffer overrun for ar9287

This backport is from linux kernel upstream commit 83d6f1f ("ath9k:
fix buffer overrun for ar9287").

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Christian Hesse 8 years ago
parent
commit
858f56e68b
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      src/drivers/net/ath/ath9k/ath9k_eeprom.c

+ 3
- 4
src/drivers/net/ath/ath9k/ath9k_eeprom.c View File

368
 
368
 
369
 	if (match) {
369
 	if (match) {
370
 		if (AR_SREV_9287(ah)) {
370
 		if (AR_SREV_9287(ah)) {
371
-			/* FIXME: array overrun? */
372
 			for (i = 0; i < numXpdGains; i++) {
371
 			for (i = 0; i < numXpdGains; i++) {
373
 				minPwrT4[i] = data_9287[idxL].pwrPdg[i][0];
372
 				minPwrT4[i] = data_9287[idxL].pwrPdg[i][0];
374
-				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4];
373
+				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][intercepts - 1];
375
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
374
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
376
 						data_9287[idxL].pwrPdg[i],
375
 						data_9287[idxL].pwrPdg[i],
377
 						data_9287[idxL].vpdPdg[i],
376
 						data_9287[idxL].vpdPdg[i],
381
 		} else if (eeprom_4k) {
380
 		} else if (eeprom_4k) {
382
 			for (i = 0; i < numXpdGains; i++) {
381
 			for (i = 0; i < numXpdGains; i++) {
383
 				minPwrT4[i] = data_4k[idxL].pwrPdg[i][0];
382
 				minPwrT4[i] = data_4k[idxL].pwrPdg[i][0];
384
-				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][4];
383
+				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][intercepts - 1];
385
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
384
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
386
 						data_4k[idxL].pwrPdg[i],
385
 						data_4k[idxL].pwrPdg[i],
387
 						data_4k[idxL].vpdPdg[i],
386
 						data_4k[idxL].vpdPdg[i],
391
 		} else {
390
 		} else {
392
 			for (i = 0; i < numXpdGains; i++) {
391
 			for (i = 0; i < numXpdGains; i++) {
393
 				minPwrT4[i] = data_def[idxL].pwrPdg[i][0];
392
 				minPwrT4[i] = data_def[idxL].pwrPdg[i][0];
394
-				maxPwrT4[i] = data_def[idxL].pwrPdg[i][4];
393
+				maxPwrT4[i] = data_def[idxL].pwrPdg[i][intercepts - 1];
395
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
394
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
396
 						data_def[idxL].pwrPdg[i],
395
 						data_def[idxL].pwrPdg[i],
397
 						data_def[idxL].vpdPdg[i],
396
 						data_def[idxL].vpdPdg[i],

Loading…
Cancel
Save