Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] rtlwifi: core: use eth_broadcast_addr() to assign broadcast
@ 2020-07-27  2:16 Xu Wang
  2020-07-27  5:51 ` Pkshih
  0 siblings, 1 reply; 2+ messages in thread
From: Xu Wang @ 2020-07-27  2:16 UTC (permalink / raw)
  To: pkshih, kvalo, davem, kuba, linux-wireless, netdev; +Cc: linux-kernel, Xu Wang

This patch is to use eth_broadcast_addr() to assign broadcast address
insetad of memcpy().

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/net/wireless/realtek/rtlwifi/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
index 4dd82c6052f0..8bb49b77b5c8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -1512,7 +1512,6 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	bool wep_only = false;
 	int err = 0;
 	u8 mac_addr[ETH_ALEN];
-	u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
 	rtlpriv->btcoexist.btc_info.in_4way = false;
 
@@ -1634,7 +1633,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 			memcpy(rtlpriv->sec.key_buf[key_idx],
 			       key->key, key->keylen);
 			rtlpriv->sec.key_len[key_idx] = key->keylen;
-			memcpy(mac_addr, bcast_addr, ETH_ALEN);
+			eth_broadcast_addr(mac_addr);
 		} else {	/* pairwise key */
 			RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
 				 "set pairwise key\n");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtlwifi: core: use eth_broadcast_addr() to assign broadcast
  2020-07-27  2:16 [PATCH] rtlwifi: core: use eth_broadcast_addr() to assign broadcast Xu Wang
@ 2020-07-27  5:51 ` Pkshih
  0 siblings, 0 replies; 2+ messages in thread
From: Pkshih @ 2020-07-27  5:51 UTC (permalink / raw)
  To: linux-wireless, kvalo, davem, netdev, vulab, kuba; +Cc: linux-kernel

On Mon, 2020-07-27 at 02:16 +0000, Xu Wang wrote:
> This patch is to use eth_broadcast_addr() to assign broadcast address
> insetad of memcpy().
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>  drivers/net/wireless/realtek/rtlwifi/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c
> b/drivers/net/wireless/realtek/rtlwifi/core.c
> index 4dd82c6052f0..8bb49b77b5c8 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/core.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/core.c
> @@ -1512,7 +1512,6 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum
> set_key_cmd cmd,
>  	bool wep_only = false;
>  	int err = 0;
>  	u8 mac_addr[ETH_ALEN];
> -	u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
>  
>  	rtlpriv->btcoexist.btc_info.in_4way = false;
>  


'bcast_addr' is also used by debug:

        RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,                                  
                 "%s hardware based encryption for keyidx: %d, mac: %pM\n",     
                  cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,          
                  sta ? sta->addr : bcast_addr); 

If you turn on CONFIG_RTLWIFI_DEBUG, compiler must warn an error.
So, NACK.

> @@ -1634,7 +1633,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum
> set_key_cmd cmd,
>  			memcpy(rtlpriv->sec.key_buf[key_idx],
>  			       key->key, key->keylen);
>  			rtlpriv->sec.key_len[key_idx] = key->keylen;
> -			memcpy(mac_addr, bcast_addr, ETH_ALEN);
> +			eth_broadcast_addr(mac_addr);
>  		} else {	/* pairwise key */
>  			RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
>  				 "set pairwise key\n");

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27  2:16 [PATCH] rtlwifi: core: use eth_broadcast_addr() to assign broadcast Xu Wang
2020-07-27  5:51 ` Pkshih

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org
	public-inbox-index linux-wireless

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git