diff options
author | K.T.VIJAYAKUMAAR <vijay.bvb@samsung.com> | 2018-09-03 19:07:44 +0200 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-09-06 18:04:10 +0200 |
commit | 97c69a70dc2cecb2c3b96a66529e0082dabc2d2c (patch) | |
tree | 7aa59dbc00b5e5c88447653683a8a63613d55365 /drivers/net/wireless/ath/ath10k/wmi.c | |
parent | ath10k: add debugfs support to dump per sta tx stats (diff) | |
download | linux-97c69a70dc2cecb2c3b96a66529e0082dabc2d2c.tar.xz linux-97c69a70dc2cecb2c3b96a66529e0082dabc2d2c.zip |
ath10k: avoid possible memory access violation
array "ctl_power_table" access index "pream" is initialized with -1 and
is raised as a static analysis tool issue.
[drivers\net\wireless\ath\ath10k\wmi.c:4719] ->
[drivers\net\wireless\ath\ath10k\wmi.c:4730]: (error) Array index -1 is
out of bounds.
Since the "pream" index for accessing ctl_power_table array is initialized
with -1, there is a chance of memory access violation for the cases below.
1) wmi_pdev_tpc_final_table_event change frequency is between 2483 and 5180
2) pream_idx is out of the enumeration ranges of wmi_tpc_pream_2ghz,
wmi_tpc_pream_5ghz
Signed-off-by: K.T.VIJAYAKUMAAR <vijay.bvb@samsung.com>
[kvalo@codeaurora.org: clean up the warning message]
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/wireless/ath/ath10k/wmi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 212005cd0646..43daa4e57bc1 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -4780,6 +4780,13 @@ ath10k_wmi_tpc_final_get_rate(struct ath10k *ar, } } + if (pream == -1) { + ath10k_warn(ar, "unknown wmi tpc final index and frequency: %u, %u\n", + pream_idx, __le32_to_cpu(ev->chan_freq)); + tpc = 0; + goto out; + } + if (pream == 4) tpc = min_t(u8, ev->rates_array[rate_idx], ev->max_reg_allow_pow[ch]); |