linux/drivers/net/wireless/realtek/rtl8xxxu
Colin Ian King 80e5acb6dd wifi: rtl8xxxu: Fix reads of uninitialized variables hw_ctrl_s1, sw_ctrl_s1
Variables hw_ctrl_s1 and sw_ctrl_s1 are not being initialized and
potentially can contain any garbage value. Currently there is an if
statement that sets one or the other of these variables, followed
by an if statement that checks if any of these variables have been
set to a non-zero value. In the case where they may contain
uninitialized non-zero values, the latter if statement may be
taken as true when it was not expected to.

Fix this by ensuring hw_ctrl_s1 and sw_ctrl_s1 are initialized.

Cleans up clang warning:
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:432:7: warning:
variable 'hw_ctrl_s1' is used uninitialized whenever 'if' condition is
false [-Wsometimes-uninitialized]
                if (hw_ctrl) {
                    ^~~~~~~
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:440:7: note: uninitialized
use occurs here
                if (hw_ctrl_s1 || sw_ctrl_s1) {
                    ^~~~~~~~~~
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:432:3: note: remove the 'if'
if its condition is always true
                if (hw_ctrl) {
                ^~~~~~~~~~~~~

Fixes: c888183b21 ("wifi: rtl8xxxu: Support new chip RTL8188FU")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20221020135709.1549086-1-colin.i.king@gmail.com
2022-10-21 15:54:06 +03:00
..
Kconfig wifi: rtl8xxxu: Update module description 2022-10-12 07:33:59 +03:00
Makefile wifi: rtl8xxxu: Support new chip RTL8188FU 2022-10-04 11:09:33 +03:00
rtl8xxxu_8188f.c wifi: rtl8xxxu: Fix reads of uninitialized variables hw_ctrl_s1, sw_ctrl_s1 2022-10-21 15:54:06 +03:00
rtl8xxxu_8192c.c wifi: rtl8xxxu: Make some arrays const 2022-10-12 07:33:58 +03:00
rtl8xxxu_8192e.c wifi: rtl8xxxu: Make some arrays const 2022-10-12 07:33:58 +03:00
rtl8xxxu_8723a.c wifi: rtl8xxxu: Make some arrays const 2022-10-12 07:33:58 +03:00
rtl8xxxu_8723b.c wifi: rtl8xxxu: Make some arrays const 2022-10-12 07:33:58 +03:00
rtl8xxxu_core.c wifi: rtl8xxxu: Fix reading the vendor of combo chips 2022-10-12 07:33:59 +03:00
rtl8xxxu_regs.h wifi: rtl8xxxu: Support new chip RTL8188FU 2022-10-04 11:09:33 +03:00
rtl8xxxu.h wifi: rtl8xxxu: Make some arrays const 2022-10-12 07:33:58 +03:00