Commit 30bfce0b authored by Xinming Hu's avatar Xinming Hu Committed by Kalle Valo

mwifiex: correct histogram data with appropriate index

Correct snr/nr/rssi data index to avoid possible buffer underflow.
Signed-off-by: default avatarXinming Hu <huxm@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent cbec83d4
......@@ -708,12 +708,14 @@ void mwifiex_hist_data_set(struct mwifiex_private *priv, u8 rx_rate, s8 snr,
s8 nflr)
{
struct mwifiex_histogram_data *phist_data = priv->hist_data;
s8 nf = -nflr;
s8 rssi = snr - nflr;
atomic_inc(&phist_data->num_samples);
atomic_inc(&phist_data->rx_rate[rx_rate]);
atomic_inc(&phist_data->snr[snr]);
atomic_inc(&phist_data->noise_flr[128 + nflr]);
atomic_inc(&phist_data->sig_str[nflr - snr]);
atomic_inc(&phist_data->snr[snr + 128]);
atomic_inc(&phist_data->noise_flr[nf + 128]);
atomic_inc(&phist_data->sig_str[rssi + 128]);
}
/* function to reset histogram data during init/reset */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment