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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3e0b0efc0c0142bbb79cb11f927967bb@realtek.com>
Date:   Thu, 26 Aug 2021 00:58:13 +0000
From:   Pkshih <pkshih@...ltek.com>
To:     Kees Cook <keescook@...omium.org>
CC:     Kalle Valo <kvalo@...eaurora.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Larry Finger <Larry.Finger@...inger.net>,
        Colin Ian King <colin.king@...onical.com>,
        "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Joe Perches <joe@...ches.com>,
        Kaixu Xia <kaixuxia@...cent.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>
Subject: RE: [PATCH] rtlwifi: rtl8192de: Style clean-ups


> -----Original Message-----
> From: Kees Cook [mailto:keescook@...omium.org]
> Sent: Thursday, August 26, 2021 2:34 AM
> To: Pkshih
> Cc: Kees Cook; Kalle Valo; David S. Miller; Jakub Kicinski; Larry Finger; Colin Ian King;
> linux-wireless@...r.kernel.org; netdev@...r.kernel.org; Joe Perches; Kaixu Xia;
> linux-kernel@...r.kernel.org; linux-hardening@...r.kernel.org
> Subject: [PATCH] rtlwifi: rtl8192de: Style clean-ups
> 
> Clean up some style issues:
> - Use ARRAY_SIZE() even though it's a u8 array.
> - Remove redundant CHANNEL_MAX_NUMBER_2G define.
> Additionally fix some dead code WARNs.
> 
> Cc: Ping-Ke Shih <pkshih@...ltek.com>
> Cc: Kalle Valo <kvalo@...eaurora.org>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Larry Finger <Larry.Finger@...inger.net>
> Cc: Colin Ian King <colin.king@...onical.com>
> Cc: linux-wireless@...r.kernel.org
> Cc: netdev@...r.kernel.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
>  drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 8 +++-----
>  drivers/net/wireless/realtek/rtlwifi/wifi.h          | 1 -
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
> index b32fa7a75f17..9807c9e91998 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
> @@ -899,7 +899,7 @@ static u8 _rtl92c_phy_get_rightchnlplace(u8 chnl)
>  	u8 place = chnl;
> 
>  	if (chnl > 14) {
> -		for (place = 14; place < sizeof(channel5g); place++) {
> +		for (place = 14; place < ARRAY_SIZE(channel5g); place++) {

There are still many places we can use ARRAY_SIZE() instead of sizeof().
Could you fix them within this file, even this driver?
Otherwise, this patch looks good to me.

Acked-by: Ping-Ke Shih <pkshih@...ltek.com>

>  			if (channel5g[place] == chnl) {
>  				place++;
>  				break;
> @@ -2861,16 +2861,14 @@ u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw)
>  	case BAND_ON_5G:
>  		/* Get first channel error when change between
>  		 * 5G and 2.4G band. */
> -		if (channel <= 14)
> +		if (WARN_ONCE(channel <= 14, "rtl8192de: 5G but channel<=14\n"))
>  			return 0;
> -		WARN_ONCE((channel <= 14), "rtl8192de: 5G but channel<=14\n");
>  		break;
>  	case BAND_ON_2_4G:
>  		/* Get first channel error when change between
>  		 * 5G and 2.4G band. */
> -		if (channel > 14)
> +		if (WARN_ONCE(channel > 14, "rtl8192de: 2G but channel>14\n"))
>  			return 0;
> -		WARN_ONCE((channel > 14), "rtl8192de: 2G but channel>14\n");
>  		break;
>  	default:
>  		WARN_ONCE(true, "rtl8192de: Invalid WirelessMode(%#x)!!\n",
> diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h
> b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> index aa07856411b1..31f9e9e5c680 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
> +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> @@ -108,7 +108,6 @@
>  #define	CHANNEL_GROUP_IDX_5GM		6
>  #define	CHANNEL_GROUP_IDX_5GH		9
>  #define	CHANNEL_GROUP_MAX_5G		9
> -#define CHANNEL_MAX_NUMBER_2G		14
>  #define AVG_THERMAL_NUM			8
>  #define AVG_THERMAL_NUM_88E		4
>  #define AVG_THERMAL_NUM_8723BE		4
> --
> 2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ