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] [day] [month] [year] [list]
Date:   Tue, 26 Jan 2021 08:46:53 -0800
From:   Joe Perches <joe@...ches.com>
To:     Jiapeng Zhong <abaci-bugfix@...ux.alibaba.com>,
        kvalo@...eaurora.org
Cc:     pkshih@...ltek.com, davem@...emloft.net, kuba@...nel.org,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] rtlwifi: Simplify bool comparison

On Tue, 2021-01-26 at 16:31 +0800, Jiapeng Zhong wrote:
> Fix the following coccicheck warning:
> ./drivers/net/wireless/realtek/rtlwifi/ps.c:798:7-21: WARNING:
> Comparison to bool
> ./drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:3848:7-17:
> WARNING: Comparison of 0/1 to bool variable
[]
> diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c
[]
> @@ -798,9 +798,9 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
>  		ie += 3 + noa_len;
>  	}
>  
> 
> -	if (find_p2p_ie == true) {
> +	if (find_p2p_ie) {
>  		if ((p2pinfo->p2p_ps_mode > P2P_PS_NONE) &&
> -		    (find_p2p_ps_ie == false))
> +		    (!find_p2p_ps_ie))
>  			rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
>  	}

Always review suggested coccinelle patches before submission and
see if there are ways to improve the code beyond what the spatch
tool suggests.

Perhaps integrate these tests and removed an indent level too:

	if (find_p2p_ie && !find_p2p_ps_ie &&
	    p2pinfo->p2p_ps_mode > P2P_PS_NONE)
		rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ