* [PATCH] rtlwifi: make a couple arrays larger
@ 2017-08-18 8:05 Dan Carpenter
2017-08-18 13:09 ` Larry Finger
2017-08-24 9:54 ` Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-08-18 8:05 UTC (permalink / raw)
To: Larry Finger
Cc: Chaoming Li, Kalle Valo, Ping-Ke Shih, Maxim Samoylov,
linux-wireless, kernel-janitors
This is a static checker fix. "cal_num" is 10. We're declaring the
tx_dt[] and rx_td[] arrays as 3 element arrays. The static checker
complains that we do:
tx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20);
"cal" is the iterator and it is in the 0-9 range so it looks like
we could corrupt memory.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I'm pretty sure this patch is correct and absolutely harmless. But the
code is pretty involved and I didn't test it. So you may want to review
this one carefully.
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index aa3ccc740521..176deb2b5386 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -3773,10 +3773,11 @@ static void _rtl8821ae_iqk_tx(struct ieee80211_hw *hw, enum radio_path path)
u32 tx_fail, rx_fail, delay_count, iqk_ready, cal_retry, cal = 0, temp_reg65;
int tx_x = 0, tx_y = 0, rx_x = 0, rx_y = 0, tx_average = 0, rx_average = 0;
int tx_x0[cal_num], tx_y0[cal_num], tx_x0_rxk[cal_num],
- tx_y0_rxk[cal_num], rx_x0[cal_num], rx_y0[cal_num];
+ tx_y0_rxk[cal_num], rx_x0[cal_num], rx_y0[cal_num],
+ tx_dt[cal_num], rx_dt[cal_num];
bool tx0iqkok = false, rx0iqkok = false;
bool vdf_enable = false;
- int i, k, vdf_y[3], vdf_x[3], tx_dt[3], rx_dt[3],
+ int i, k, vdf_y[3], vdf_x[3],
ii, dx = 0, dy = 0, tx_finish = 0, rx_finish = 0;
RT_TRACE(rtlpriv, COMP_IQK, DBG_LOUD,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rtlwifi: make a couple arrays larger
2017-08-18 8:05 [PATCH] rtlwifi: make a couple arrays larger Dan Carpenter
@ 2017-08-18 13:09 ` Larry Finger
2017-08-24 9:54 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Larry Finger @ 2017-08-18 13:09 UTC (permalink / raw)
To: Dan Carpenter
Cc: Chaoming Li, Kalle Valo, Ping-Ke Shih, Maxim Samoylov,
linux-wireless, kernel-janitors
On 08/18/2017 03:05 AM, Dan Carpenter wrote:
> This is a static checker fix. "cal_num" is 10. We're declaring the
> tx_dt[] and rx_td[] arrays as 3 element arrays. The static checker
> complains that we do:
>
> tx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20);
>
> "cal" is the iterator and it is in the 0-9 range so it looks like
> we could corrupt memory.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I'm pretty sure this patch is correct and absolutely harmless. But the
> code is pretty involved and I didn't test it. So you may want to review
> this one carefully.
I believe the patch is correct. In testing, I also confirmed that this branch is
executed, thus the memory corruption does happen.
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Thanks,
Larry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: rtlwifi: make a couple arrays larger
2017-08-18 8:05 [PATCH] rtlwifi: make a couple arrays larger Dan Carpenter
2017-08-18 13:09 ` Larry Finger
@ 2017-08-24 9:54 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2017-08-24 9:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: Larry Finger, Chaoming Li, Ping-Ke Shih, Maxim Samoylov,
linux-wireless, kernel-janitors
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> This is a static checker fix. "cal_num" is 10. We're declaring the
> tx_dt[] and rx_td[] arrays as 3 element arrays. The static checker
> complains that we do:
>
> tx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20);
>
> "cal" is the iterator and it is in the 0-9 range so it looks like
> we could corrupt memory.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Patch applied to wireless-drivers-next.git, thanks.
d9ee6015e573 rtlwifi: make a couple arrays larger
--
https://patchwork.kernel.org/patch/9907821/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-24 9:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-18 8:05 [PATCH] rtlwifi: make a couple arrays larger Dan Carpenter
2017-08-18 13:09 ` Larry Finger
2017-08-24 9:54 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox