* [PATCH] rtlwifi: rtl8192de: fix ofdm power compensation
@ 2020-12-07 3:19 Ping-Ke Shih
2020-12-09 7:22 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Ping-Ke Shih @ 2020-12-07 3:19 UTC (permalink / raw)
To: kvalo; +Cc: Larry.Finger, linux-wireless, dan.carpenter
ofdm_index[] is used to indicate how many power compensation is needed to
current thermal value. For internal PA module or 2.4G band, the min_index
is different from other cases.
This issue originally is reported by Dan. He found the size of ofdm_index[]
is 2, but access index 'i' may be equal to 2 if 'rf' is 2 in case of
'is2t'.
In fact, the chunk of code is added to wrong place, so move it back to
proper place, and then power compensation and buffer overflow are fixed.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
index b3f25a228532..6cc9c7649eda 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
@@ -986,18 +986,19 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
rtlpriv->dm.cck_index);
}
for (i = 0; i < rf; i++) {
- if (ofdm_index[i] > OFDM_TABLE_SIZE_92D - 1)
+ if (ofdm_index[i] > OFDM_TABLE_SIZE_92D - 1) {
ofdm_index[i] = OFDM_TABLE_SIZE_92D - 1;
- else if (ofdm_index[i] < ofdm_min_index)
+ } else if (internal_pa ||
+ rtlhal->current_bandtype == BAND_ON_2_4G) {
+ if (ofdm_index[i] < ofdm_min_index_internal_pa)
+ ofdm_index[i] = ofdm_min_index_internal_pa;
+ } else if (ofdm_index[i] < ofdm_min_index) {
ofdm_index[i] = ofdm_min_index;
+ }
}
if (rtlhal->current_bandtype == BAND_ON_2_4G) {
if (cck_index > CCK_TABLE_SIZE - 1) {
cck_index = CCK_TABLE_SIZE - 1;
- } else if (internal_pa ||
- rtlhal->current_bandtype == BAND_ON_2_4G) {
- if (ofdm_index[i] < ofdm_min_index_internal_pa)
- ofdm_index[i] = ofdm_min_index_internal_pa;
} else if (cck_index < 0) {
cck_index = 0;
}
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtlwifi: rtl8192de: fix ofdm power compensation
2020-12-07 3:19 [PATCH] rtlwifi: rtl8192de: fix ofdm power compensation Ping-Ke Shih
@ 2020-12-09 7:22 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-12-09 7:22 UTC (permalink / raw)
To: Ping-Ke Shih; +Cc: Larry.Finger, linux-wireless, dan.carpenter
Ping-Ke Shih <pkshih@realtek.com> wrote:
> ofdm_index[] is used to indicate how many power compensation is needed to
> current thermal value. For internal PA module or 2.4G band, the min_index
> is different from other cases.
>
> This issue originally is reported by Dan. He found the size of ofdm_index[]
> is 2, but access index 'i' may be equal to 2 if 'rf' is 2 in case of
> 'is2t'.
>
> In fact, the chunk of code is added to wrong place, so move it back to
> proper place, and then power compensation and buffer overflow are fixed.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Patch applied to wireless-drivers-next.git, thanks.
3f79e541593f rtlwifi: rtl8192de: fix ofdm power compensation
--
https://patchwork.kernel.org/project/linux-wireless/patch/20201207031903.7599-1-pkshih@realtek.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-09 7:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-07 3:19 [PATCH] rtlwifi: rtl8192de: fix ofdm power compensation Ping-Ke Shih
2020-12-09 7:22 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).