lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1FlEABysKCjobzu@thelio-3990X>
Date:   Thu, 20 Oct 2022 08:11:12 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Colin Ian King <colin.i.king@...il.com>
Cc:     Jes Sorensen <Jes.Sorensen@...il.com>,
        Kalle Valo <kvalo@...nel.org>,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Bitterblue Smith <rtl8821cerfe2@...il.com>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] wifi: rtl8xxxu: Fix reads of uninitialized
 variables hw_ctrl_s1, sw_ctrl_s1

On Thu, Oct 20, 2022 at 02:57:09PM +0100, Colin Ian King wrote:
> 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: c888183b21f3 ("wifi: rtl8xxxu: Support new chip RTL8188FU")
> Signed-off-by: Colin Ian King <colin.i.king@...il.com>

I was getting ready to send a similar patch.

Reviewed-by: Nathan Chancellor <nathan@...nel.org>

> ---
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> index 99610bb2afd5..0025bb32538d 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> @@ -412,7 +412,7 @@ static void rtl8188f_spur_calibration(struct rtl8xxxu_priv *priv, u8 channel)
>  	};
>  
>  	const u8 threshold = 0x16;
> -	bool do_notch, hw_ctrl, sw_ctrl, hw_ctrl_s1, sw_ctrl_s1;
> +	bool do_notch, hw_ctrl, sw_ctrl, hw_ctrl_s1 = 0, sw_ctrl_s1 = 0;
>  	u32 val32, initial_gain, reg948;
>  
>  	val32 = rtl8xxxu_read32(priv, REG_OFDM0_RX_D_SYNC_PATH);
> -- 
> 2.37.3
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ