staging: r8188eu: use helper to check for broadcast address
authorMartin Kaiser <martin@kaiser.cx>
Wed, 20 Oct 2021 19:53:59 +0000 (21:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Oct 2021 08:27:05 +0000 (10:27 +0200)
Use the is_broadcast_ether_addr function to check for a
broadcast address.

Acked-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20211020195401.12931-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme_ext.c
drivers/staging/r8188eu/hal/odm.c

index 995a0248c26f5db78ae4dfeae1e8a66ee6db96d7..b0dfafe526f76489cf0bed597363fb6eb9f51961 100644 (file)
@@ -392,13 +392,12 @@ void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)
 
 static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptable, struct recv_frame *precv_frame)
 {
-       u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
        u8 *pframe = precv_frame->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);
        }
@@ -409,7 +408,6 @@ void mgt_dispatcher(struct adapter *padapter, struct 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->rx_data;
        struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(pframe));
 
@@ -418,7 +416,7 @@ void mgt_dispatcher(struct adapter *padapter, struct 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;
 
        ptable = mlme_sta_tbl;
index 67cf8f7baba573cc0d997a80de207f8554708b6d..21f115194df8b88112bdb1f1705843ac31ff05dd 100644 (file)
@@ -829,7 +829,6 @@ void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm)
        u8      sta_cnt = 0;
        u32 PWDB_rssi[NUM_STA] = {0};/* 0~15]:MACID, [16~31]:PWDB_rssi */
        struct sta_info *psta;
-       u8 bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
        if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR))
                return;
@@ -841,7 +840,7 @@ void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm)
                psta = pDM_Odm->pODM_StaInfo[i];
                if (IS_STA_VALID(psta) &&
                    (psta->state & WIFI_ASOC_STATE) &&
-                   memcmp(psta->hwaddr, bcast_addr, ETH_ALEN) &&
+                   !is_broadcast_ether_addr(psta->hwaddr) &&
                    memcmp(psta->hwaddr, myid(&Adapter->eeprompriv), ETH_ALEN)) {
                        if (psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB)
                                tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB;