public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Phillip Potter <phil@philpotter.co.uk>
To: Martin Kaiser <martin@kaiser.cx>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Michael Straube <straube.linux@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] staging: r8188eu: use helper to set broadcast address
Date: Wed, 20 Oct 2021 22:08:30 +0100	[thread overview]
Message-ID: <YXCFToOeWveWDVXp@equinox> (raw)
In-Reply-To: <20211020195401.12931-4-martin@kaiser.cx>

On Wed, Oct 20, 2021 at 09:54:00PM +0200, Martin Kaiser wrote:
> The eth_broadcast_addr helper assigns the broadcast address to an address
> array. Call this function instead of copying the address bytes manually.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  drivers/staging/r8188eu/core/rtw_mlme_ext.c | 13 +++++--------
>  drivers/staging/r8188eu/hal/rtl8188e_cmd.c  |  3 +--
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> index b0dfafe526f7..7b372374e638 100644
> --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> @@ -3409,7 +3409,6 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack)
>  	unsigned char			*mac;
>  	struct xmit_priv		*pxmitpriv = &padapter->xmitpriv;
>  	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
> -	u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
>  	struct wifidirect_info	*pwdinfo = &padapter->wdinfo;
>  	u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 };
>  	u16 wpsielen = 0, p2pielen = 0;
> @@ -3443,8 +3442,8 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack)
>  			memcpy(pwlanhdr->addr3, pwdinfo->p2p_peer_interface_addr, ETH_ALEN);
>  		} else {
>  			/*	broadcast probe request frame */
> -			memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
> -			memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN);
> +			eth_broadcast_addr(pwlanhdr->addr1);
> +			eth_broadcast_addr(pwlanhdr->addr3);
>  		}
>  	}
>  	memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
> @@ -4311,7 +4310,6 @@ void issue_beacon(struct adapter *padapter, int timeout_ms)
>  	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
>  	struct mlme_ext_info	*pmlmeinfo = &pmlmeext->mlmext_info;
>  	struct wlan_bssid_ex		*cur_network = &pmlmeinfo->network;
> -	u8	bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
>  	struct wifidirect_info	*pwdinfo = &padapter->wdinfo;
>  
>  	pmgntframe = alloc_mgtxmitframe(pxmitpriv);
> @@ -4334,7 +4332,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms)
>  	fctrl = &pwlanhdr->frame_ctl;
>  	*(fctrl) = 0;
>  
> -	memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
> +	eth_broadcast_addr(pwlanhdr->addr1);
>  	memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
>  	memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN);
>  
> @@ -4676,7 +4674,6 @@ static int _issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *ps
>  	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>  	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
>  	int	bssrate_len = 0;
> -	u8	bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
>  
>  	pmgntframe = alloc_mgtxmitframe(pxmitpriv);
>  	if (!pmgntframe)
> @@ -4702,8 +4699,8 @@ static int _issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *ps
>  		memcpy(pwlanhdr->addr3, da, ETH_ALEN);
>  	} else {
>  		/*	broadcast probe request frame */
> -		memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
> -		memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN);
> +		eth_broadcast_addr(pwlanhdr->addr1);
> +		eth_broadcast_addr(pwlanhdr->addr3);
>  	}
>  
>  	memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> index c5f9353fe3e6..14eed14a4c6a 100644
> --- a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> +++ b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> @@ -226,14 +226,13 @@ static void ConstructBeacon(struct adapter *adapt, u8 *pframe, u32 *pLength)
>  	struct mlme_ext_priv *pmlmeext = &adapt->mlmeextpriv;
>  	struct mlme_ext_info	*pmlmeinfo = &pmlmeext->mlmext_info;
>  	struct wlan_bssid_ex		*cur_network = &pmlmeinfo->network;
> -	u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
>  
>  	pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
>  
>  	fctrl = &pwlanhdr->frame_ctl;
>  	*(fctrl) = 0;
>  
> -	memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
> +	eth_broadcast_addr(pwlanhdr->addr1);
>  	memcpy(pwlanhdr->addr2, myid(&adapt->eeprompriv), ETH_ALEN);
>  	memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN);
>  
> -- 
> 2.20.1
> 

Looks good.

Acked-by: Phillip Potter <phil@philpotter.co.uk>

Regards,
Phil

  reply	other threads:[~2021-10-20 21:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 19:53 [PATCH 1/5] staging: r8188eu: remove unused dm_priv components Martin Kaiser
2021-10-20 19:53 ` [PATCH 2/5] staging: r8188eu: odm_rate_adapt Type is constant Martin Kaiser
2021-10-20 21:06   ` Phillip Potter
2021-10-21 10:18   ` Michael Straube
2021-10-20 19:53 ` [PATCH 3/5] staging: r8188eu: use helper to check for broadcast address Martin Kaiser
2021-10-20 21:07   ` Phillip Potter
2021-10-21 10:12     ` Michael Straube
2021-10-22  9:21       ` Martin Kaiser
2021-11-02 14:59         ` Dan Carpenter
2021-10-20 19:54 ` [PATCH 4/5] staging: r8188eu: use helper to set " Martin Kaiser
2021-10-20 21:08   ` Phillip Potter [this message]
2021-10-21 10:20   ` Michael Straube
2021-10-20 19:54 ` [PATCH 5/5] staging: r8188eu: remove unused defines and enums Martin Kaiser
2021-10-20 21:10   ` Phillip Potter
2021-10-21 10:21   ` Michael Straube
2021-10-20 21:05 ` [PATCH 1/5] staging: r8188eu: remove unused dm_priv components Phillip Potter
2021-10-21 10:17 ` Michael Straube

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=YXCFToOeWveWDVXp@equinox \
    --to=phil@philpotter.co.uk \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=martin@kaiser.cx \
    --cc=straube.linux@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