[PATCH -next 1/3] staging: rtl8723bs: os_dep: use eth_broadcast_addr() to assign broadcast address

From: Yang Yingliang
Date: Wed Jun 16 2021 - 04:08:59 EST


Using eth_broadcast_addr() to assign broadcast address instead
of memset() or copying from an array that contains the all-ones
broadcast address.

Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
---
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 5 ++---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index cb605351ac8d..727c9fdad06a 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -229,7 +229,6 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
size_t len, bssinf_len = 0;
struct ieee80211_hdr *pwlanhdr;
__le16 *fctrl;
- u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

struct wireless_dev *wdev = padapter->rtw_wdev;
struct wiphy *wiphy = wdev->wiphy;
@@ -310,7 +309,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
/* pmlmeext->mgnt_seq++; */

if (pnetwork->network.Reserved[0] == 1) { /* WIFI_BEACON */
- memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
+ eth_broadcast_addr(pwlanhdr->addr1);
SetFrameSubType(pbuf, WIFI_BEACON);
} else {
memcpy(pwlanhdr->addr1, myid(&(padapter->eeprompriv)), ETH_ALEN);
@@ -960,7 +959,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
memset(param, 0, param_len);

param->cmd = IEEE_CMD_SET_ENCRYPTION;
- memset(param->sta_addr, 0xff, ETH_ALEN);
+ eth_broadcast_addr(param->sta_addr);

switch (params->cipher) {
case IW_AUTH_CIPHER_NONE:
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 149d3b6e44d0..5032701171f6 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -1915,7 +1915,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
return -1;

param->cmd = IEEE_CMD_SET_ENCRYPTION;
- memset(param->sta_addr, 0xff, ETH_ALEN);
+ eth_broadcast_addr(param->sta_addr);


switch (pext->alg) {
--
2.25.1