Skip to content

Commit 6b96947

Browse files
Alexey Velichayshiygregkh
authored andcommitted
wifi: rtw89: phy: fix uninitialized variable access in rtw89_phy_cfo_set_crystal_cap()
[ Upstream commit 047cddf ] In the rtw89_phy_cfo_set_crystal_cap() function, for chips other than RTL8852A/RTL8851B, the values read by rtw89_mac_read_xtal_si() are stored into the local variables sc_xi_val and sc_xo_val. If either read fails, these variables remain uninitialized, they are later used to update cfo->crystal_cap and in debug print statements. This can lead to undefined behavior. Fix the issue by initializing sc_xi_val and sc_xo_val to zero, like is implemented in vendor driver. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 8379fa6 ("rtw89: 8852c: add write/read crystal function in CFO tracking") Signed-off-by: Alexey Velichayshiy <a.velichayshiy@ispras.ru> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260323140613.1615574-1-a.velichayshiy@ispras.ru Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 97757d2 commit 6b96947

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/wireless/realtek/rtw89

drivers/net/wireless/realtek/rtw89/phy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4499,7 +4499,7 @@ static void rtw89_phy_cfo_set_crystal_cap(struct rtw89_dev *rtwdev,
44994499
{
45004500
struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking;
45014501
const struct rtw89_chip_info *chip = rtwdev->chip;
4502-
u8 sc_xi_val, sc_xo_val;
4502+
u8 sc_xi_val = 0, sc_xo_val = 0;
45034503

45044504
if (!force && cfo->crystal_cap == crystal_cap)
45054505
return;

0 commit comments

Comments
 (0)