Commit 2f59ee3f authored by Yang Yingliang's avatar Yang Yingliang Committed by Greg Kroah-Hartman
Browse files

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: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230804083841.1321554-2-yangyingliang@huawei.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent af019910
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1238,7 +1238,6 @@ void rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
	struct sta_priv *pstapriv = &padapter->stapriv;
	struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
	struct __queue	*pacl_node_q = &pacl_list->acl_node_q;
	u8 baddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };	/* Baddr is used for clearing acl_list */

	spin_lock_bh(&(pacl_node_q->lock));

@@ -1248,7 +1247,7 @@ void rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)

		if (
			!memcmp(paclnode->addr, addr, ETH_ALEN) ||
			!memcmp(baddr, addr, ETH_ALEN)
			is_broadcast_ether_addr(addr)
		) {
			if (paclnode->valid) {
				paclnode->valid = false;
+2 −4
Original line number Diff line number Diff line
@@ -421,13 +421,12 @@ void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)

static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptable, union recv_frame *precv_frame)
{
	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
	u8 *pframe = precv_frame->u.hdr.rx_data;

	if (ptable->func) {
		/* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
		if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
		    memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN))
		    !is_broadcast_ether_addr(GetAddr1Ptr(pframe)))
			return;

		ptable->func(padapter, precv_frame);
@@ -439,7 +438,6 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame)
	int index;
	struct mlme_handler *ptable;
	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
	u8 *pframe = precv_frame->u.hdr.rx_data;
	struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(pframe));
	struct dvobj_priv *psdpriv = padapter->dvobj;
@@ -450,7 +448,7 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame)

	/* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
	if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
		memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) {
	    !is_broadcast_ether_addr(GetAddr1Ptr(pframe))) {
		return;
	}

+2 −4
Original line number Diff line number Diff line
@@ -1779,10 +1779,9 @@ void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len)
void rtw_alloc_macid(struct adapter *padapter, struct sta_info *psta)
{
	int i;
	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
	struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);

	if (!memcmp(psta->hwaddr, bc_addr, ETH_ALEN))
	if (is_broadcast_ether_addr(psta->hwaddr))
		return;

	if (!memcmp(psta->hwaddr, myid(&padapter->eeprompriv), ETH_ALEN)) {
@@ -1807,10 +1806,9 @@ void rtw_alloc_macid(struct adapter *padapter, struct sta_info *psta)

void rtw_release_macid(struct adapter *padapter, struct sta_info *psta)
{
	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
	struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);

	if (!memcmp(psta->hwaddr, bc_addr, ETH_ALEN))
	if (is_broadcast_ether_addr(psta->hwaddr))
		return;

	if (!memcmp(psta->hwaddr, myid(&padapter->eeprompriv), ETH_ALEN))