From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8D7FC433EF for ; Sun, 3 Apr 2022 16:38:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359459AbiDCQkn (ORCPT ); Sun, 3 Apr 2022 12:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358708AbiDCQkj (ORCPT ); Sun, 3 Apr 2022 12:40:39 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 698F2DEED for ; Sun, 3 Apr 2022 09:38:44 -0700 (PDT) Received: from dslb-094-219-033-178.094.219.pools.vodafone-ip.de ([94.219.33.178] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1nb3FC-00080j-6Z; Sun, 03 Apr 2022 18:38:26 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 2/2] staging: r8188eu: use ieee80211 helpers in validate_recv_mgnt_frame Date: Sun, 3 Apr 2022 18:38:18 +0200 Message-Id: <20220403163818.357173-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220403163818.357173-1-martin@kaiser.cx> References: <20220403163818.357173-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the ieee80211 helpers to detect the frame subtype in and to parse mac addresses in validate_recv_mgnt_frame. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_recv.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 8fa07d37d07b..1a79c3f46bbf 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -915,24 +915,24 @@ static void validate_recv_mgnt_frame(struct adapter *padapter, struct recv_frame *precv_frame) { struct sta_info *psta; + struct ieee80211_hdr *hdr; precv_frame = recvframe_chk_defrag(padapter, precv_frame); if (!precv_frame) return; - /* for rx pkt statistics */ - psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(precv_frame->rx_data)); + hdr = (struct ieee80211_hdr *)precv_frame->rx_data; + psta = rtw_get_stainfo(&padapter->stapriv, hdr->addr2); if (psta) { psta->sta_stats.rx_mgnt_pkts++; - if (GetFrameSubType(precv_frame->rx_data) == WIFI_BEACON) { + if (ieee80211_is_beacon(hdr->frame_control)) psta->sta_stats.rx_beacon_pkts++; - } else if (GetFrameSubType(precv_frame->rx_data) == WIFI_PROBEREQ) { + else if (ieee80211_is_probe_req(hdr->frame_control)) psta->sta_stats.rx_probereq_pkts++; - } else if (GetFrameSubType(precv_frame->rx_data) == WIFI_PROBERSP) { - if (!memcmp(padapter->eeprompriv.mac_addr, GetAddr1Ptr(precv_frame->rx_data), ETH_ALEN)) + else if (ieee80211_is_probe_resp(hdr->frame_control)) { + if (!memcmp(padapter->eeprompriv.mac_addr, hdr->addr1, ETH_ALEN)) psta->sta_stats.rx_probersp_pkts++; - else if (is_broadcast_mac_addr(GetAddr1Ptr(precv_frame->rx_data)) || - is_multicast_mac_addr(GetAddr1Ptr(precv_frame->rx_data))) + else if (is_broadcast_mac_addr(hdr->addr1) || is_multicast_mac_addr(hdr->addr1)) psta->sta_stats.rx_probersp_bm_pkts++; else psta->sta_stats.rx_probersp_uo_pkts++; -- 2.30.2