Fix Array Out of Bounds in rcSibUpdate_ht()
[open-ath9k-htc-firmware.git] / target_firmware / wlan / ratectrl_11n_ln.c
index eefad46dfd26d0da3dd10181cb64fd71a4834c7c..de10a2757055ccd91d232d1f1aea07560165be1c 100755 (executable)
@@ -369,7 +369,7 @@ rcSibUpdate_ht(struct ath_softc_tgt *sc, struct ath_node_target *an,
        rcInitValidTxMask(pRc);
 
        for (i = 0; i < WLAN_RC_PHY_MAX; i++) {
-               for (j = 0; j < MAX_TX_RATE_PHY; j++) {
+               for (j = 0; j < MAX_TX_RATE_TBL; j++) {
                        mPhyCtrlState.validPhyRateIndex[i][j] = 0;
                }   
                mPhyCtrlState.validPhyRateCount[i] = 0;
@@ -1040,12 +1040,6 @@ ath_rate_attach(struct ath_softc_tgt *sc)
        return &asc->arc;
 }
 
-void
-ath_rate_detach(struct ath_ratectrl *rc)
-{
-       adf_os_mem_free(rc);
-}
-
 void
 ath_rate_findrate(struct ath_softc_tgt *sc,
                   struct ath_node_target *an,
@@ -1170,33 +1164,3 @@ ath_rate_newassoc_11n(struct ath_softc_tgt *sc, struct ath_node_target *an, int
                rcSibUpdate_ht(sc, an, capflag, 0, rs);
        }
 }
-
-void ath_rate_mcs2rate(struct ath_softc_tgt *sc,a_uint8_t sgi, a_uint8_t ht40, 
-                      a_uint8_t rateCode, a_uint32_t *txrate, a_uint32_t *rxrate)
-{
-       int idx;
-       struct atheros_softc *asc = (struct atheros_softc*)sc->sc_rc;
-       RATE_TABLE_11N *pRateTable = (RATE_TABLE_11N *)asc->hwRateTable[sc->sc_curmode];
-       a_uint32_t rateKbps = 0;
-   
-       *txrate = asc->currentTxRateKbps;
-
-       /* look  11NA table for rateKbps*/
-       for (idx = 0; idx < pRateTable->rateCount && !rateKbps; ++idx) {   
-               if (pRateTable->info[idx].rateCode == rateCode) {
-                       if(ht40 && sgi) {
-                               if(pRateTable->info[idx].valid == TRUE_40 &&
-                                  pRateTable->info[idx].phy == WLAN_RC_PHY_HT_40_DS_HGI)
-                                       rateKbps = pRateTable->info[idx].rateKbps;
-                       } else if (ht40) {
-                               if (pRateTable->info[idx].valid == TRUE_40)/* HT40 only*/
-                                       rateKbps = pRateTable->info[idx].rateKbps;
-                       } else { 
-                               if (pRateTable->info[idx].valid != FALSE)
-                                       rateKbps = pRateTable->info[idx].rateKbps;
-                       }
-               }
-       }
-    
-       *rxrate = rateKbps;
-}