public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: William Hansen-Baird <william.hansen.baird@gmail.com>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] staging: rtl8723bs: core/rtw_mlme_ext.c: initialize copy_len, clearing later control-flow.
Date: Tue, 27 Jan 2026 15:38:29 +0100	[thread overview]
Message-ID: <2026012720-ending-obsessive-3555@gregkh> (raw)
In-Reply-To: <20260116160914.88069-5-william.hansen.baird@gmail.com>

On Fri, Jan 16, 2026 at 11:08:51AM -0500, William Hansen-Baird wrote:
> Initialize copy_len to 0 in rtw_parse_assoc_security_ies function.
> This allows later if-statement to not have to explicitly set copy_len to 0.
> Thus we can make the if statement single-lined, and remove the braces
> from the if-else branch.
> The change is purely cosmetic and changes no logic.
> 
> Signed-off-by: William Hansen-Baird <william.hansen.baird@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index 842e95e1eaec..d470725a033f 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -946,6 +946,7 @@ static unsigned short rtw_parse_assoc_security_ies(struct adapter *padapter,
>  	pstat->wpa_pairwise_cipher = 0;
>  	pstat->wpa2_pairwise_cipher = 0;
>  	memset(pstat->wpa_ie, 0, sizeof(pstat->wpa_ie));
> +
>  	if ((psecuritypriv->wpa_psk & BIT(1)) && elems->rsn_ie) {
>  
>  		int group_cipher = 0, pairwise_cipher = 0;

Why this line added?

> @@ -1016,17 +1017,15 @@ static unsigned short rtw_parse_assoc_security_ies(struct adapter *padapter,
>  		}
>  
>  	} else {
> -		int copy_len;
> +		int copy_len = 0;
>  
>  		if (psecuritypriv->wpa_psk == 0) 
>  			return WLAN_STATUS_INVALID_IE;
>  
> -		if (elems->wps_ie) {
> +		if (elems->wps_ie)
>  			pstat->flags |= WLAN_STA_WPS;
> -			copy_len = 0;
> -		} else {
> +		else
>  			copy_len = min_t(int, sizeof(pstat->wpa_ie), wpa_ie_len+2);
> -		}
>  
>  		if (copy_len > 0)
>  			memcpy(pstat->wpa_ie, wpa_ie-2, copy_len);

I feel like this is just polishing the code for no reason at all.  Why
make this change at all?  What asked for it?

thanks,

greg k-h

  reply	other threads:[~2026-01-27 14:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16 16:08 [PATCH 1/5] staging: rtl8723bs: core/rtw_mlme_ext.c: refactor security IE parsing in OnAssocReq William Hansen-Baird
2026-01-16 16:08 ` [PATCH 2/5] staging: rtl8723bs: core/rtw_mlme_ext.c: remove unnecessary else statement William Hansen-Baird
2026-01-16 16:08 ` [PATCH 3/5] staging: rtl8723bs: core/rtw_mlme_ext.c: remove braces for one-line if-statements William Hansen-Baird
2026-01-16 16:08 ` [PATCH 4/5] staging: rtl8723bs: replace ternary comparison with min_t() William Hansen-Baird
2026-01-27 14:37   ` Greg KH
2026-01-16 16:08 ` [PATCH 5/5] staging: rtl8723bs: core/rtw_mlme_ext.c: initialize copy_len, clearing later control-flow William Hansen-Baird
2026-01-27 14:38   ` Greg KH [this message]
2026-01-31 22:10     ` William Hansen-Baird
2026-01-27 14:39 ` [PATCH 1/5] staging: rtl8723bs: core/rtw_mlme_ext.c: refactor security IE parsing in OnAssocReq Greg KH
2026-01-31 21:58   ` William Hansen-Baird

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026012720-ending-obsessive-3555@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=william.hansen.baird@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox