OSDN Git Service

staging: r8188eu: pattrib addresses were already set by the caller
authorMartin Kaiser <martin@kaiser.cx>
Thu, 7 Jul 2022 19:49:14 +0000 (21:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Jul 2022 12:29:07 +0000 (14:29 +0200)
Do not set pattrib's src, dst, bssid, ra and ta again in
sta2sta_data_frame.

sta2sta_data_frame is called from validate_recv_data_frame when both to_ds
and from_ds are 0. All pattrib address fields have already been set to the
correct addresses when sta2sta_data_frame is called.

        memcpy(pattrib->dst, ieee80211_get_DA(hdr), ETH_ALEN);
            ieee80211_get_DA returns addr1 if to_ds and from_ds are 0

        memcpy(pattrib->src, ieee80211_get_SA(hdr), ETH_ALEN);
            ieee80211_get_SA returns addr2 if to_ds and from_ds are 0

        memcpy(pattrib->ra, hdr->addr1, ETH_ALEN);
        memcpy(pattrib->ta, hdr->addr2, ETH_ALEN);
            For pattrib->dst == addr1, pattrib->src == addr2, these
            assignments match those in sta2sta_data_frame that this
            patch removes.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220707194914.63794-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_recv.c

index 6a2a1b1..e5a7b7d 100644 (file)
@@ -559,7 +559,6 @@ static void count_rx_stats(struct adapter *padapter, struct recv_frame *prframe,
 static int sta2sta_data_frame(struct adapter *adapter,
                              struct recv_frame *precv_frame, struct sta_info **psta)
 {
-       u8 *ptr = precv_frame->rx_data;
        int ret = _SUCCESS;
        struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
        struct  sta_priv *pstapriv = &adapter->stapriv;
@@ -614,12 +613,6 @@ static int sta2sta_data_frame(struct adapter *adapter,
                        sta_addr = pattrib->src;
                }
        } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
-               memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN);
-               memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN);
-               memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN);
-               memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
-               memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
                sta_addr = mybssid;
        } else {
                ret  = _FAIL;