From d88a36bdc5e421207b1ba9eb26cce16bb61bb9cd Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 3 Apr 2022 18:54:35 +0200 Subject: [PATCH] staging: r8188eu: ra and ta do not depend on to_ds, from_ds The "DS bit usage" table in include/linux/ieee80211.h shows that ra is always addr1 and ta is always addr2. We can set pattrib->ra and pattrib->ta regardless of the to_ds and from_ds bits. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220403165438.357728-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 0098f3d..75c0e0b 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -962,19 +962,15 @@ static int validate_recv_data_frame(struct adapter *adapter, if (ieee80211_has_a4(hdr->frame_control)) return _FAIL; - if (ieee80211_has_fromds(hdr->frame_control)) { - memcpy(pattrib->ra, pda, ETH_ALEN); - memcpy(pattrib->ta, pbssid, ETH_ALEN); + memcpy(pattrib->ra, hdr->addr1, ETH_ALEN); + memcpy(pattrib->ta, hdr->addr2, ETH_ALEN); + + if (ieee80211_has_fromds(hdr->frame_control)) ret = ap2sta_data_frame(adapter, precv_frame, &psta); - } else if (ieee80211_has_tods(hdr->frame_control)) { - memcpy(pattrib->ra, pbssid, ETH_ALEN); - memcpy(pattrib->ta, psa, ETH_ALEN); + else if (ieee80211_has_tods(hdr->frame_control)) ret = sta2ap_data_frame(adapter, precv_frame, &psta); - } else { - memcpy(pattrib->ra, pda, ETH_ALEN); - memcpy(pattrib->ta, psa, ETH_ALEN); + else ret = sta2sta_data_frame(adapter, precv_frame, &psta); - } if (ret == _FAIL || ret == RTW_RX_HANDLED) return ret; -- 2.7.4