[PATCH 2/2] staging: r8188eu: pattrib addresses were already set by the caller

From: Martin Kaiser
Date: Thu Jul 07 2022 - 15:49:34 EST


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@xxxxxxxxx>
---
drivers/staging/r8188eu/core/rtw_recv.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 6a2a1b1664ac..e5a7b7dfc387 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -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;
--
2.30.2