Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: rtl8723bs: use is_broadcast_ether_addr() instead of memcmp()

Use is_broadcast_ether_addr() instead of memcmp to check
if the ethernet address is broadcast address.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230804083841.1321554-2-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Yang Yingliang and committed by
Greg Kroah-Hartman
2f59ee3f af019910

+5 -10
+1 -2
drivers/staging/rtl8723bs/core/rtw_ap.c
··· 1238 1238 struct sta_priv *pstapriv = &padapter->stapriv; 1239 1239 struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; 1240 1240 struct __queue *pacl_node_q = &pacl_list->acl_node_q; 1241 - u8 baddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; /* Baddr is used for clearing acl_list */ 1242 1241 1243 1242 spin_lock_bh(&(pacl_node_q->lock)); 1244 1243 ··· 1247 1248 1248 1249 if ( 1249 1250 !memcmp(paclnode->addr, addr, ETH_ALEN) || 1250 - !memcmp(baddr, addr, ETH_ALEN) 1251 + is_broadcast_ether_addr(addr) 1251 1252 ) { 1252 1253 if (paclnode->valid) { 1253 1254 paclnode->valid = false;
+2 -4
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
··· 421 421 422 422 static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptable, union recv_frame *precv_frame) 423 423 { 424 - u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 425 424 u8 *pframe = precv_frame->u.hdr.rx_data; 426 425 427 426 if (ptable->func) { 428 427 /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ 429 428 if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) && 430 - memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) 429 + !is_broadcast_ether_addr(GetAddr1Ptr(pframe))) 431 430 return; 432 431 433 432 ptable->func(padapter, precv_frame); ··· 438 439 int index; 439 440 struct mlme_handler *ptable; 440 441 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 441 - u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 442 442 u8 *pframe = precv_frame->u.hdr.rx_data; 443 443 struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(pframe)); 444 444 struct dvobj_priv *psdpriv = padapter->dvobj; ··· 448 450 449 451 /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ 450 452 if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) && 451 - memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) { 453 + !is_broadcast_ether_addr(GetAddr1Ptr(pframe))) { 452 454 return; 453 455 } 454 456
+2 -4
drivers/staging/rtl8723bs/core/rtw_wlan_util.c
··· 1779 1779 void rtw_alloc_macid(struct adapter *padapter, struct sta_info *psta) 1780 1780 { 1781 1781 int i; 1782 - u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 1783 1782 struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); 1784 1783 1785 - if (!memcmp(psta->hwaddr, bc_addr, ETH_ALEN)) 1784 + if (is_broadcast_ether_addr(psta->hwaddr)) 1786 1785 return; 1787 1786 1788 1787 if (!memcmp(psta->hwaddr, myid(&padapter->eeprompriv), ETH_ALEN)) { ··· 1806 1807 1807 1808 void rtw_release_macid(struct adapter *padapter, struct sta_info *psta) 1808 1809 { 1809 - u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 1810 1810 struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); 1811 1811 1812 - if (!memcmp(psta->hwaddr, bc_addr, ETH_ALEN)) 1812 + if (is_broadcast_ether_addr(psta->hwaddr)) 1813 1813 return; 1814 1814 1815 1815 if (!memcmp(psta->hwaddr, myid(&padapter->eeprompriv), ETH_ALEN))