public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking
@ 2022-12-23 12:34 Semyon Verchenko
  2022-12-23 12:34 ` [PATCH 5.10 1/2] wifi: rtlwifi: remove always-true condition pointed out by GCC 12 Semyon Verchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Semyon Verchenko @ 2022-12-23 12:34 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Semyon Verchenko, Ping-Ke Shih, Kalle Valo, David S. Miller,
	Jakub Kicinski, Alexey Khoroshilov, lvc-project

SVACE reports always true condition issue at
tl92d_phy_reload_iqk_setting() in 5.10 stable releases. The problem has
been fixed by the following patches which can be cleanly applied to the
5.10 branch.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 5.10 1/2] wifi: rtlwifi: remove always-true condition pointed out by GCC 12
  2022-12-23 12:34 [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking Semyon Verchenko
@ 2022-12-23 12:34 ` Semyon Verchenko
  2022-12-23 12:34 ` [PATCH 5.10 2/2] wifi: rtlwifi: 8192de: correct checking of IQK reload Semyon Verchenko
  2023-01-04 12:32 ` [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking Greg Kroah-Hartman
  2 siblings, 0 replies; 4+ messages in thread
From: Semyon Verchenko @ 2022-12-23 12:34 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Semyon Verchenko, Ping-Ke Shih, Kalle Valo, David S. Miller,
	Jakub Kicinski, Alexey Khoroshilov, lvc-project, Kalle Valo

From: Jakub Kicinski <kuba@kernel.org>

commit ee3db469dd317e82f57b13aa3bc61be5cb60c2b4 upstream

The .value is a two-dim array, not a pointer.

struct iqk_matrix_regs {
	bool iqk_done;
        long value[1][IQK_MATRIX_REG_NUM];
};

Acked-by: Kalle Valo <kvalo@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Semyon Verchenko <semverchenko@factor-ts.ru>
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
index e34d33e73e52..d8a57e96a92f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
@@ -2385,10 +2385,7 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel)
 			rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD,
 				"Just Read IQK Matrix reg for channel:%d....\n",
 				channel);
-			if ((rtlphy->iqk_matrix[indexforchannel].
-			     value[0] != NULL)
-				/*&&(regea4 != 0) */)
-				_rtl92d_phy_patha_fill_iqk_matrix(hw, true,
+			_rtl92d_phy_patha_fill_iqk_matrix(hw, true,
 					rtlphy->iqk_matrix[
 					indexforchannel].value,	0,
 					(rtlphy->iqk_matrix[
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 5.10 2/2] wifi: rtlwifi: 8192de: correct checking of IQK reload
  2022-12-23 12:34 [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking Semyon Verchenko
  2022-12-23 12:34 ` [PATCH 5.10 1/2] wifi: rtlwifi: remove always-true condition pointed out by GCC 12 Semyon Verchenko
@ 2022-12-23 12:34 ` Semyon Verchenko
  2023-01-04 12:32 ` [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking Greg Kroah-Hartman
  2 siblings, 0 replies; 4+ messages in thread
From: Semyon Verchenko @ 2022-12-23 12:34 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Semyon Verchenko, Ping-Ke Shih, Kalle Valo, David S. Miller,
	Jakub Kicinski, Alexey Khoroshilov, lvc-project, Kalle Valo

From: Ping-Ke Shih <pkshih@realtek.com>

commit 93fbc1ebd978cf408ef5765e9c1630fce9a8621b upstream

Since IQK could spend time, we make a cache of IQK result matrix that looks
like iqk_matrix[channel_idx].val[x][y], and we can reload the matrix if we
have made a cache. To determine a cache is made, we check
iqk_matrix[channel_idx].val[0][0].

The initial commit 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines")
make a mistake that checks incorrect iqk_matrix[channel_idx].val[0] that
is always true, and this mistake is found by commit ee3db469dd31
("wifi: rtlwifi: remove always-true condition pointed out by GCC 12"), so
I recall the vendor driver to find fix and apply the correctness.

Fixes: 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Signed-off-by: Semyon Verchenko <semverchenko@factor-ts.ru>
Link: https://lore.kernel.org/r/20220801113345.42016-1-pkshih@realtek.com
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
index d8a57e96a92f..d3027f8fbd38 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
@@ -2385,11 +2385,10 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel)
 			rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD,
 				"Just Read IQK Matrix reg for channel:%d....\n",
 				channel);
-			_rtl92d_phy_patha_fill_iqk_matrix(hw, true,
-					rtlphy->iqk_matrix[
-					indexforchannel].value,	0,
-					(rtlphy->iqk_matrix[
-					indexforchannel].value[0][2] == 0));
+			if (rtlphy->iqk_matrix[indexforchannel].value[0][0] != 0)
+				_rtl92d_phy_patha_fill_iqk_matrix(hw, true,
+					rtlphy->iqk_matrix[indexforchannel].value, 0,
+					rtlphy->iqk_matrix[indexforchannel].value[0][2] == 0);
 			if (IS_92D_SINGLEPHY(rtlhal->version)) {
 				if ((rtlphy->iqk_matrix[
 					indexforchannel].value[0][4] != 0)
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking
  2022-12-23 12:34 [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking Semyon Verchenko
  2022-12-23 12:34 ` [PATCH 5.10 1/2] wifi: rtlwifi: remove always-true condition pointed out by GCC 12 Semyon Verchenko
  2022-12-23 12:34 ` [PATCH 5.10 2/2] wifi: rtlwifi: 8192de: correct checking of IQK reload Semyon Verchenko
@ 2023-01-04 12:32 ` Greg Kroah-Hartman
  2 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-04 12:32 UTC (permalink / raw)
  To: Semyon Verchenko
  Cc: stable, Ping-Ke Shih, Kalle Valo, David S. Miller, Jakub Kicinski,
	Alexey Khoroshilov, lvc-project

On Fri, Dec 23, 2022 at 03:34:14PM +0300, Semyon Verchenko wrote:
> SVACE reports always true condition issue at
> tl92d_phy_reload_iqk_setting() in 5.10 stable releases. The problem has
> been fixed by the following patches which can be cleanly applied to the
> 5.10 branch.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-04 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-23 12:34 [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking Semyon Verchenko
2022-12-23 12:34 ` [PATCH 5.10 1/2] wifi: rtlwifi: remove always-true condition pointed out by GCC 12 Semyon Verchenko
2022-12-23 12:34 ` [PATCH 5.10 2/2] wifi: rtlwifi: 8192de: correct checking of IQK reload Semyon Verchenko
2023-01-04 12:32 ` [PATCH 5.10 0/2] wifi: rtlwifi: 8192de: fix IQK reload checking Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox