rtwn: remove out-of-bounds access + fix debug output.
Omit unused rates while initializing / dumping Tx power values. They were not accessed anywhere (except for debugging), so this is (mostly) no-op. Tested with * RTL8188EU, STA mode. * RTL8812AU, STA mode. Found by: PVS-Studio
This commit is contained in:
parent
29c5f354fe
commit
b14b54982c
@ -110,7 +110,7 @@ r88e_get_txpower(struct rtwn_softc *sc, int chain,
|
||||
for (ridx = RTWN_RIDX_CCK1; ridx <= RTWN_RIDX_CCK11; ridx++)
|
||||
power[ridx] = base->pwr[0][ridx];
|
||||
}
|
||||
for (ridx = RTWN_RIDX_OFDM6; ridx < RTWN_RIDX_COUNT; ridx++) {
|
||||
for (ridx = RTWN_RIDX_OFDM6; ridx <= max_mcs; ridx++) {
|
||||
if (rs->regulatory == 3)
|
||||
power[ridx] = base->pwr[0][ridx];
|
||||
else if (rs->regulatory == 1) {
|
||||
|
@ -229,13 +229,13 @@ r92c_set_txpower(struct rtwn_softc *sc, struct ieee80211_channel *c)
|
||||
rtwn_r92c_get_txpower(sc, i, c, power);
|
||||
#ifdef RTWN_DEBUG
|
||||
if (sc->sc_debug & RTWN_DEBUG_TXPWR) {
|
||||
int ridx;
|
||||
int max_mcs, ridx;
|
||||
|
||||
max_mcs = RTWN_RIDX_MCS(sc->ntxchains * 8 - 1);
|
||||
|
||||
/* Dump per-rate Tx power values. */
|
||||
printf("Tx power for chain %d:\n", i);
|
||||
for (ridx = RTWN_RIDX_CCK1;
|
||||
ridx < RTWN_RIDX_COUNT;
|
||||
ridx++)
|
||||
for (ridx = RTWN_RIDX_CCK1; ridx <= max_mcs; ridx++)
|
||||
printf("Rate %d = %u\n", ridx, power[ridx]);
|
||||
}
|
||||
#endif
|
||||
|
@ -247,7 +247,7 @@ r12a_get_txpower(struct rtwn_softc *sc, int chain,
|
||||
if (sc->sc_debug & RTWN_DEBUG_TXPWR) {
|
||||
/* Dump per-rate Tx power values. */
|
||||
printf("Tx power for chain %d:\n", chain);
|
||||
for (ridx = RTWN_RIDX_CCK1; ridx < RTWN_RIDX_COUNT; ridx++)
|
||||
for (ridx = RTWN_RIDX_CCK1; ridx <= max_mcs; ridx++)
|
||||
printf("Rate %d = %u\n", ridx, power[ridx]);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user