mirror of
https://github.com/armbian/build.git
synced 2025-08-09 12:46:58 +02:00
* sunxi-6.0: initial state: add megous patches to series * sunxi-6.0: Switch to v6.0.1 * wifi: Limit the version 6.0 for Realtek 88x2cs chipsets * Adjust kernel configs * Remove not needed patches * Adjust broken patches Co-authored-by: Igor <igor@armbian.com>
65 lines
1.9 KiB
Diff
65 lines
1.9 KiB
Diff
From fd0862b9e89b1f2b1f88921332f4187a04ff263f Mon Sep 17 00:00:00 2001
|
|
From: Zong-Zhe Yang <kevin_yang@realtek.com>
|
|
Date: Wed, 27 Jul 2022 14:50:03 +0800
|
|
Subject: [PATCH 378/486] wifi: rtw88: phy: fix warning of possible buffer
|
|
overflow
|
|
|
|
reported by smatch
|
|
|
|
phy.c:854 rtw_phy_linear_2_db() error: buffer overflow 'db_invert_table[i]'
|
|
8 <= 8 (assuming for loop doesn't break)
|
|
|
|
However, it seems to be a false alarm because we prevent it originally via
|
|
if (linear >= db_invert_table[11][7])
|
|
return 96; /* maximum 96 dB */
|
|
|
|
Still, we adjust the code to be more readable and avoid smatch warning.
|
|
|
|
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
|
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
|
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
|
Link: https://lore.kernel.org/r/20220727065003.28340-5-pkshih@realtek.com
|
|
---
|
|
drivers/net/wireless/realtek/rtw88/phy.c | 21 ++++++++-------------
|
|
1 file changed, 8 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
|
|
index 8982e0c98..da1efec0a 100644
|
|
--- a/drivers/net/wireless/realtek/rtw88/phy.c
|
|
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
|
|
@@ -816,23 +816,18 @@ static u8 rtw_phy_linear_2_db(u64 linear)
|
|
u8 j;
|
|
u32 dB;
|
|
|
|
- if (linear >= db_invert_table[11][7])
|
|
- return 96; /* maximum 96 dB */
|
|
-
|
|
for (i = 0; i < 12; i++) {
|
|
- if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][7])
|
|
- break;
|
|
- else if (i > 2 && linear <= db_invert_table[i][7])
|
|
- break;
|
|
+ for (j = 0; j < 8; j++) {
|
|
+ if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][j])
|
|
+ goto cnt;
|
|
+ else if (i > 2 && linear <= db_invert_table[i][j])
|
|
+ goto cnt;
|
|
+ }
|
|
}
|
|
|
|
- for (j = 0; j < 8; j++) {
|
|
- if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][j])
|
|
- break;
|
|
- else if (i > 2 && linear <= db_invert_table[i][j])
|
|
- break;
|
|
- }
|
|
+ return 96; /* maximum 96 dB */
|
|
|
|
+cnt:
|
|
if (j == 0 && i == 0)
|
|
goto end;
|
|
|
|
--
|
|
2.35.3
|
|
|