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: <aXsEd2bzf35y8i_E@stanley.mountain>
Date: Thu, 29 Jan 2026 09:55:51 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Michael Huang <tehsiu.huang@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Joe Perches <joe@...ches.com>, linux-staging@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: refactor BSS Coexistence channel
 report logic

On Wed, Jan 28, 2026 at 12:45:10PM -0800, Michael Huang wrote:
> Refactor the 'ICS' array in issue_action_BSSCoexistPacket() to improve
> readability and maintainability. This addresses technical debt related
> to magic numbers and ambiguous array usage.
> 
> The original implementation used a multi-purpose 2D array (ICS[8][15])
> where magic numbers were prevalent and the first element of each row
> was overloaded as a status flag. This patch:
> 
> - Introduces descriptive macros: BSS_COEX_MAX_CLASSES,
>   BSS_COEX_MAX_CHANNELS, and BSS_COEX_MAX_INFO_LEN.
> - Splits the overloaded array into two distinct boolean arrays:
>   'class_active' (for group status) and 'ch_present' (for channel data).
> - Converts the logic to use 'bool' types and 0-indexed loops,
>   conforming to standard C programming practices.
> - Adds defensive boundary checks (ch > 0 && ch < MAX) to ensure
>   robustness against unexpected channel data.
> 
> This refactoring maintains the current 2.4GHz reporting behavior while
> providing a structured and extensible foundation for future Operating
> Class support according to IEEE 802.11 specifications.
> 
> Signed-off-by: Michael Huang <tehsiu.huang@...il.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 41 +++++++------------
>  .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  3 ++
>  2 files changed, 18 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index 884fcce50d9c..481295224f14 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -3587,8 +3587,9 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
>  	struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
>  	struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
>  	struct __queue		*queue	= &(pmlmepriv->scanned_queue);
> -	u8 InfoContent[16] = {0};
> -	u8 ICS[8][15];
> +	u8 InfoContent[BSS_COEX_MAX_INFO_LEN] = {0};
> +	bool class_active[BSS_COEX_MAX_CLASSES] = {false};

We only ever set the first element in the class_active[] array.
#puzzled

> +	bool ch_present[BSS_COEX_MAX_CLASSES][BSS_COEX_MAX_CHANNELS] = {{false}};

Btw, use "= {};" to initialize arrays to zero.  It's not standard C, but
it's kernel C.

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ