From nobody Sun Feb 8 11:46:42 2026 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 DDA49C4167B for ; Sat, 26 Nov 2022 16:01:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbiKZQBm (ORCPT ); Sat, 26 Nov 2022 11:01:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiKZQBl (ORCPT ); Sat, 26 Nov 2022 11:01:41 -0500 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 2F604193DF for ; Sat, 26 Nov 2022 08:01:40 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxcU-0000Ub-Q4; Sat, 26 Nov 2022 17:01:34 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 01/10] staging: r8188eu: replace one GetAddr3Ptr call Date: Sat, 26 Nov 2022 17:01:20 +0100 Message-Id: <20221126160129.178697-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Define a struct ieee80211_mgmt in the OnBeacon function. Use it to replace one GetAddr3Ptr call. This is a tiny step towards making GetAddr3Ptr obsolete. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 93696892ec7d..80342b53a129 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -560,6 +560,7 @@ static void OnProbeRsp(struct adapter *padapter, struct= recv_frame *precv_frame) =20 static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_fr= ame) { + struct ieee80211_mgmt *mgmt =3D (struct ieee80211_mgmt *)precv_frame->rx_= data; int cam_idx; struct sta_info *psta; struct mlme_ext_priv *pmlmeext =3D &padapter->mlmeextpriv; @@ -576,7 +577,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) return; } =20 - if (!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_A= LEN)) { + if (!memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) { if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { /* we should update current network before auth, or some IE is wrong */ pbss =3D kmalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 A5542C4321E for ; Sat, 26 Nov 2022 16:01:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbiKZQBt (ORCPT ); Sat, 26 Nov 2022 11:01:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbiKZQBl (ORCPT ); Sat, 26 Nov 2022 11:01:41 -0500 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 11593193E2 for ; Sat, 26 Nov 2022 08:01:41 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxcV-0000Ub-Jx; Sat, 26 Nov 2022 17:01:35 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 02/10] staging: r8188eu: read timestamp from ieee80211_mgmt Date: Sat, 26 Nov 2022 17:01:21 +0100 Message-Id: <20221126160129.178697-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Read the 64-bit timestamp from struct ieee80211_mgmt instead of parsing the beacon message ourselves. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 80342b53a129..66e3a90da3a3 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -389,21 +389,6 @@ static u32 p2p_listen_state_process(struct adapter *pa= dapter, unsigned char *da) return _SUCCESS; } =20 -static void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe) -{ - u8 *pIE; - __le32 *pbuf; - - pIE =3D pframe + sizeof(struct ieee80211_hdr_3addr); - pbuf =3D (__le32 *)pIE; - - pmlmeext->TSFValue =3D le32_to_cpu(*(pbuf + 1)); - - pmlmeext->TSFValue =3D pmlmeext->TSFValue << 32; - - pmlmeext->TSFValue |=3D le32_to_cpu(*pbuf); -} - static void correct_TSF(struct adapter *padapter) { u8 reg; @@ -592,8 +577,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) /* check the vendor of the assoc AP */ pmlmeinfo->assoc_AP_vendor =3D check_assoc_AP(pframe + sizeof(struct ie= ee80211_hdr_3addr), len - sizeof(struct ieee80211_hdr_3addr)); =20 - /* update TSF Value */ - update_TSF(pmlmeext, pframe); + pmlmeext->TSFValue =3D le64_to_cpu(mgmt->u.beacon.timestamp); =20 /* start auth */ start_clnt_auth(padapter); @@ -635,8 +619,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) return; } =20 - /* update TSF Value */ - update_TSF(pmlmeext, pframe); + pmlmeext->TSFValue =3D le64_to_cpu(mgmt->u.beacon.timestamp); =20 /* report sta add event */ report_add_sta_event(padapter, GetAddr2Ptr(pframe), cam_idx); --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 ABAF2C4321E for ; Sat, 26 Nov 2022 16:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229526AbiKZQB5 (ORCPT ); Sat, 26 Nov 2022 11:01:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbiKZQBm (ORCPT ); Sat, 26 Nov 2022 11:01:42 -0500 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 605ED193E0 for ; Sat, 26 Nov 2022 08:01:42 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxcW-0000Ub-D3; Sat, 26 Nov 2022 17:01:36 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 03/10] staging: r8188eu: replace GetAddr2Ptr calls Date: Sat, 26 Nov 2022 17:01:22 +0100 Message-Id: <20221126160129.178697-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Get the source address of a beacon frame from our struct ieee80211_mgmt instead of using the driver's internal GetAddr2Ptr helper. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 66e3a90da3a3..5a31b20dc46d 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -586,7 +586,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) } =20 if (((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_STATION_STATE) && (pmlmein= fo->state & WIFI_FW_ASSOC_SUCCESS)) { - psta =3D rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); + psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); if (psta) { ret =3D rtw_check_bcn_info(padapter, pframe, len); if (!ret) { @@ -601,7 +601,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) process_p2p_ps_ie(padapter, (pframe + WLAN_HDR_A3_LEN), (len - WLAN_HD= R_A3_LEN)); } } else if ((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE) { - psta =3D rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); + psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); if (psta) { /* update WMM, ERP in the beacon */ /* todo: the timer is used instead of the number of the beacon receive= d */ @@ -621,8 +621,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) =20 pmlmeext->TSFValue =3D le64_to_cpu(mgmt->u.beacon.timestamp); =20 - /* report sta add event */ - report_add_sta_event(padapter, GetAddr2Ptr(pframe), cam_idx); + report_add_sta_event(padapter, mgmt->sa, cam_idx); } } } --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 30D68C4321E for ; Sat, 26 Nov 2022 16:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229480AbiKZQBx (ORCPT ); Sat, 26 Nov 2022 11:01:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiKZQBm (ORCPT ); Sat, 26 Nov 2022 11:01:42 -0500 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 14D33193DF for ; Sat, 26 Nov 2022 08:01:41 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxcX-0000Ub-4T; Sat, 26 Nov 2022 17:01:37 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 04/10] staging: r8188eu: pass only ies to process_p2p_ps_ie Date: Sat, 26 Nov 2022 17:01:23 +0100 Message-Id: <20221126160129.178697-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The process_p2p_ps_ie function parses the information elements of a beacon message and extracts p2p-related info. process_p2p_ps_ie does not receive a pointer to the information elements as one would expect. Instead it receives a pointer to the timestamp field in the beacon message. process_p2p_ps_ie increments this pointer by _BEACON_IE_OFFSET_ to jump to the start of the information elements (and decreases the buffer length accordingly). This is clumsy and hard to understand. Rewrite this such that process_p2p_ps_ie takes a pointer to the information elements and the total length of all elements. Check up-front that the total length is not negative. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 9 ++++++++- drivers/staging/r8188eu/core/rtw_p2p.c | 11 ++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 5a31b20dc46d..07c57a2b61b9 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -556,6 +556,13 @@ static void OnBeacon(struct adapter *padapter, struct = recv_frame *precv_frame) uint len =3D precv_frame->len; struct wlan_bssid_ex *pbss; int ret =3D _SUCCESS; + u8 *ie_ptr; + u32 ie_len; + + ie_ptr =3D (u8 *)&mgmt->u.beacon.variable; + if (precv_frame->len < offsetof(struct ieee80211_mgmt, u.beacon.variable)) + return; + ie_len =3D precv_frame->len - offsetof(struct ieee80211_mgmt, u.beacon.va= riable); =20 if (pmlmeext->sitesurvey_res.state =3D=3D SCAN_PROCESS) { report_survey_event(padapter, precv_frame); @@ -598,7 +605,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) /* todo: the timer is used instead of the number of the beacon receive= d */ if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) update_beacon_info(padapter, pframe, len, psta); - process_p2p_ps_ie(padapter, (pframe + WLAN_HDR_A3_LEN), (len - WLAN_HD= R_A3_LEN)); + process_p2p_ps_ie(padapter, ie_ptr, ie_len); } } else if ((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE) { psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188= eu/core/rtw_p2p.c index dc159e58f428..ce05458bd1ad 100644 --- a/drivers/staging/r8188eu/core/rtw_p2p.c +++ b/drivers/staging/r8188eu/core/rtw_p2p.c @@ -1505,8 +1505,6 @@ void p2p_protocol_wk_hdl(struct adapter *padapter, in= t intCmdType) =20 void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength) { - u8 *ies; - u32 ies_len; u8 *p2p_ie; u32 p2p_ielen =3D 0; u8 noa_attr[MAX_P2P_IE_LEN] =3D { 0x00 };/* NoA length should be n*(13) = + 2 */ @@ -1518,13 +1516,8 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 = *IEs, u32 IELength) =20 if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; - if (IELength <=3D _BEACON_IE_OFFSET_) - return; =20 - ies =3D IEs + _BEACON_IE_OFFSET_; - ies_len =3D IELength - _BEACON_IE_OFFSET_; - - p2p_ie =3D rtw_get_p2p_ie(ies, ies_len, NULL, &p2p_ielen); + p2p_ie =3D rtw_get_p2p_ie(IEs, IELength, NULL, &p2p_ielen); =20 while (p2p_ie) { find_p2p =3D true; @@ -1579,7 +1572,7 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *= IEs, u32 IELength) } =20 /* Get the next P2P IE */ - p2p_ie =3D rtw_get_p2p_ie(p2p_ie + p2p_ielen, ies_len - (p2p_ie - ies + = p2p_ielen), NULL, &p2p_ielen); + p2p_ie =3D rtw_get_p2p_ie(p2p_ie + p2p_ielen, IELength - (p2p_ie - IEs += p2p_ielen), NULL, &p2p_ielen); } =20 if (find_p2p) { --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 00BD0C46467 for ; Sat, 26 Nov 2022 16:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229748AbiKZQCB (ORCPT ); Sat, 26 Nov 2022 11:02:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbiKZQBn (ORCPT ); Sat, 26 Nov 2022 11:01:43 -0500 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 E80FA193DF for ; Sat, 26 Nov 2022 08:01:42 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxcX-0000Ub-Rx; Sat, 26 Nov 2022 17:01:37 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 05/10] staging: r8188eu: use ie buffer in update_beacon_info Date: Sat, 26 Nov 2022 17:01:24 +0100 Message-Id: <20221126160129.178697-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The update_beacon_info function parses information elements of a beacon message. It should take the pointer to the information elements and their total length, not the entire beacon message. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 4 ++-- drivers/staging/r8188eu/core/rtw_wlan_util.c | 9 +++------ drivers/staging/r8188eu/include/rtw_mlme_ext.h | 3 +-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 07c57a2b61b9..38dc98cffbc4 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -604,7 +604,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) /* update WMM, ERP in the beacon */ /* todo: the timer is used instead of the number of the beacon receive= d */ if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) - update_beacon_info(padapter, pframe, len, psta); + update_beacon_info(padapter, ie_ptr, ie_len, psta); process_p2p_ps_ie(padapter, ie_ptr, ie_len); } } else if ((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE) { @@ -613,7 +613,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) /* update WMM, ERP in the beacon */ /* todo: the timer is used instead of the number of the beacon receive= d */ if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) - update_beacon_info(padapter, pframe, len, psta); + update_beacon_info(padapter, ie_ptr, ie_len, psta); } else { /* allocate a new CAM entry for IBSS station */ cam_idx =3D allocate_fw_sta_entry(padapter); diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging= /r8188eu/core/rtw_wlan_util.c index 965bb7da4cce..da3465d6bb0f 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -1035,16 +1035,13 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8= *pframe, u32 packet_len) return _FAIL; } =20 -void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len= , struct sta_info *psta) +void update_beacon_info(struct adapter *padapter, u8 *ie_ptr, uint ie_len,= struct sta_info *psta) { unsigned int i; - unsigned int len; struct ndis_802_11_var_ie *pIE; =20 - len =3D pkt_len - (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN); - - for (i =3D 0; i < len;) { - pIE =3D (struct ndis_802_11_var_ie *)(pframe + (_BEACON_IE_OFFSET_ + WLA= N_HDR_A3_LEN) + i); + for (i =3D 0; i < ie_len;) { + pIE =3D (struct ndis_802_11_var_ie *)(ie_ptr + i); =20 switch (pIE->ElementID) { case _HT_EXTRA_INFO_IE_: /* HT info */ diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/stagi= ng/r8188eu/include/rtw_mlme_ext.h index 089bd5446773..6724424a334e 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h @@ -447,8 +447,7 @@ void HTOnAssocRsp(struct adapter *padapter); void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *p= IE); void VCS_update(struct adapter *padapter, struct sta_info *psta); =20 -void update_beacon_info(struct adapter *padapter, u8 *pframe, uint len, - struct sta_info *psta); +void update_beacon_info(struct adapter *padapter, u8 *ie_ptr, uint ie_len,= struct sta_info *psta); int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_le= n); void update_IOT_info(struct adapter *padapter); void update_capinfo(struct adapter *adapter, u16 updatecap); --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 96C9CC4167B for ; Sat, 26 Nov 2022 16:02:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229724AbiKZQCH (ORCPT ); Sat, 26 Nov 2022 11:02:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbiKZQBo (ORCPT ); Sat, 26 Nov 2022 11:01:44 -0500 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 34AB8193F0 for ; Sat, 26 Nov 2022 08:01:43 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxcY-0000Ub-JA; Sat, 26 Nov 2022 17:01:38 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 06/10] staging: r8188eu: simplify update_sta_support_rate params Date: Sat, 26 Nov 2022 17:01:25 +0100 Message-Id: <20221126160129.178697-7-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The update_sta_support_rate function takes a pointer to information elements and the total length of all these elements. Use our variables for pointer and length instead of calculating them manually. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 38dc98cffbc4..f7d3ecf551bf 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -621,7 +621,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) return; =20 /* get supported rate */ - if (update_sta_support_rate(padapter, (pframe + WLAN_HDR_A3_LEN + _BEA= CON_IE_OFFSET_), (len - WLAN_HDR_A3_LEN - _BEACON_IE_OFFSET_), cam_idx) =3D= =3D _FAIL) { + if (update_sta_support_rate(padapter, ie_ptr, ie_len, cam_idx) =3D=3D = _FAIL) { pmlmeinfo->FW_sta_info[cam_idx].status =3D 0; return; } --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 C6529C4321E for ; Sat, 26 Nov 2022 16:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229475AbiKZQCE (ORCPT ); Sat, 26 Nov 2022 11:02:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbiKZQBo (ORCPT ); Sat, 26 Nov 2022 11:01:44 -0500 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 F31E6193ED for ; Sat, 26 Nov 2022 08:01:43 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxcZ-0000Ub-AR; Sat, 26 Nov 2022 17:01:39 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 07/10] staging: r8188eu: exit if beacon is not from our bss Date: Sat, 26 Nov 2022 17:01:26 +0100 Message-Id: <20221126160129.178697-8-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Do not process an incoming beacon message in the OnBeacon function if the beacon was sent by a base station other than the one to which we're connected. This patch does not modify the behaviour of the code. It reverts the if condition and returns if the beacon should not be processed. This is simpler than wrapping the entire processing into a large if clause. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 103 ++++++++++---------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index f7d3ecf551bf..a15998d912a7 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -569,67 +569,68 @@ static void OnBeacon(struct adapter *padapter, struct= recv_frame *precv_frame) return; } =20 - if (!memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) { - if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { - /* we should update current network before auth, or some IE is wrong */ - pbss =3D kmalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); - if (pbss) { - if (collect_bss_info(padapter, precv_frame, pbss) =3D=3D _SUCCESS) { - update_network(&pmlmepriv->cur_network.network, pbss, padapter, true); - rtw_get_bcn_info(&pmlmepriv->cur_network); - } - kfree(pbss); + if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) + return; + + if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { + /* we should update current network before auth, or some IE is wrong */ + pbss =3D kmalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); + if (pbss) { + if (collect_bss_info(padapter, precv_frame, pbss) =3D=3D _SUCCESS) { + update_network(&pmlmepriv->cur_network.network, pbss, padapter, true); + rtw_get_bcn_info(&pmlmepriv->cur_network); } + kfree(pbss); + } =20 - /* check the vendor of the assoc AP */ - pmlmeinfo->assoc_AP_vendor =3D check_assoc_AP(pframe + sizeof(struct ie= ee80211_hdr_3addr), len - sizeof(struct ieee80211_hdr_3addr)); + /* check the vendor of the assoc AP */ + pmlmeinfo->assoc_AP_vendor =3D check_assoc_AP(pframe + sizeof(struct iee= e80211_hdr_3addr), len - sizeof(struct ieee80211_hdr_3addr)); =20 - pmlmeext->TSFValue =3D le64_to_cpu(mgmt->u.beacon.timestamp); + pmlmeext->TSFValue =3D le64_to_cpu(mgmt->u.beacon.timestamp); =20 - /* start auth */ - start_clnt_auth(padapter); + /* start auth */ + start_clnt_auth(padapter); =20 - return; - } + return; + } =20 - if (((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_STATION_STATE) && (pmlmein= fo->state & WIFI_FW_ASSOC_SUCCESS)) { - psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - ret =3D rtw_check_bcn_info(padapter, pframe, len); - if (!ret) { - receive_disconnect(padapter, - pmlmeinfo->network.MacAddress, 0); - return; - } - /* update WMM, ERP in the beacon */ - /* todo: the timer is used instead of the number of the beacon receive= d */ - if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) - update_beacon_info(padapter, ie_ptr, ie_len, psta); - process_p2p_ps_ie(padapter, ie_ptr, ie_len); + if (((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_STATION_STATE) && (pmlmeinf= o->state & WIFI_FW_ASSOC_SUCCESS)) { + psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); + if (psta) { + ret =3D rtw_check_bcn_info(padapter, pframe, len); + if (!ret) { + receive_disconnect(padapter, + pmlmeinfo->network.MacAddress, 0); + return; } - } else if ((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE) { - psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - /* update WMM, ERP in the beacon */ - /* todo: the timer is used instead of the number of the beacon receive= d */ - if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) - update_beacon_info(padapter, ie_ptr, ie_len, psta); - } else { - /* allocate a new CAM entry for IBSS station */ - cam_idx =3D allocate_fw_sta_entry(padapter); - if (cam_idx =3D=3D NUM_STA) - return; + /* update WMM, ERP in the beacon */ + /* todo: the timer is used instead of the number of the beacon received= */ + if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) + update_beacon_info(padapter, ie_ptr, ie_len, psta); + process_p2p_ps_ie(padapter, ie_ptr, ie_len); + } + } else if ((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE) { + psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); + if (psta) { + /* update WMM, ERP in the beacon */ + /* todo: the timer is used instead of the number of the beacon received= */ + if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) + update_beacon_info(padapter, ie_ptr, ie_len, psta); + } else { + /* allocate a new CAM entry for IBSS station */ + cam_idx =3D allocate_fw_sta_entry(padapter); + if (cam_idx =3D=3D NUM_STA) + return; =20 - /* get supported rate */ - if (update_sta_support_rate(padapter, ie_ptr, ie_len, cam_idx) =3D=3D = _FAIL) { - pmlmeinfo->FW_sta_info[cam_idx].status =3D 0; - return; - } + /* get supported rate */ + if (update_sta_support_rate(padapter, ie_ptr, ie_len, cam_idx) =3D=3D _= FAIL) { + pmlmeinfo->FW_sta_info[cam_idx].status =3D 0; + return; + } =20 - pmlmeext->TSFValue =3D le64_to_cpu(mgmt->u.beacon.timestamp); + pmlmeext->TSFValue =3D le64_to_cpu(mgmt->u.beacon.timestamp); =20 - report_add_sta_event(padapter, mgmt->sa, cam_idx); - } + report_add_sta_event(padapter, mgmt->sa, cam_idx); } } } --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 CC9E5C4321E for ; Sat, 26 Nov 2022 16:02:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbiKZQCM (ORCPT ); Sat, 26 Nov 2022 11:02:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbiKZQBr (ORCPT ); Sat, 26 Nov 2022 11:01:47 -0500 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 2157A193ED for ; Sat, 26 Nov 2022 08:01:46 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxca-0000Ub-21; Sat, 26 Nov 2022 17:01:40 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 08/10] staging: r8188eu: stop beacon processing if kmalloc fails Date: Sat, 26 Nov 2022 17:01:27 +0100 Message-Id: <20221126160129.178697-9-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If we cannot allocate a struct wlan_bssid_ex in the OnBeacon function, we should stop processing the incoming beacon message and return. For kmalloc failures, the current code just skips the update of network and beacon info and tries to continue with the authentication. The update would set the encryption algorithm that should be used for the authentication. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index a15998d912a7..76424bcba416 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -575,13 +575,14 @@ static void OnBeacon(struct adapter *padapter, struct= recv_frame *precv_frame) if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { /* we should update current network before auth, or some IE is wrong */ pbss =3D kmalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); - if (pbss) { - if (collect_bss_info(padapter, precv_frame, pbss) =3D=3D _SUCCESS) { - update_network(&pmlmepriv->cur_network.network, pbss, padapter, true); - rtw_get_bcn_info(&pmlmepriv->cur_network); - } - kfree(pbss); + if (!pbss) + return; + + if (collect_bss_info(padapter, precv_frame, pbss) =3D=3D _SUCCESS) { + update_network(&pmlmepriv->cur_network.network, pbss, padapter, true); + rtw_get_bcn_info(&pmlmepriv->cur_network); } + kfree(pbss); =20 /* check the vendor of the assoc AP */ pmlmeinfo->assoc_AP_vendor =3D check_assoc_AP(pframe + sizeof(struct iee= e80211_hdr_3addr), len - sizeof(struct ieee80211_hdr_3addr)); --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 AE3D7C4321E for ; Sat, 26 Nov 2022 16:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229534AbiKZQCK (ORCPT ); Sat, 26 Nov 2022 11:02:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiKZQBr (ORCPT ); Sat, 26 Nov 2022 11:01:47 -0500 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 3E635193F8 for ; Sat, 26 Nov 2022 08:01:46 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxca-0000Ub-Q7; Sat, 26 Nov 2022 17:01:40 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 09/10] staging: r8188eu: simplify error handling for missing station Date: Sat, 26 Nov 2022 17:01:28 +0100 Message-Id: <20221126160129.178697-10-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Simplify the code to handle the case where we're associated to a station that is not in our list of known stations. We can simply exit in this case. This patch reverts the if-condition and saves one level of indentation. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 76424bcba416..362313c49c52 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -597,19 +597,19 @@ static void OnBeacon(struct adapter *padapter, struct= recv_frame *precv_frame) =20 if (((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_STATION_STATE) && (pmlmeinf= o->state & WIFI_FW_ASSOC_SUCCESS)) { psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - ret =3D rtw_check_bcn_info(padapter, pframe, len); - if (!ret) { - receive_disconnect(padapter, - pmlmeinfo->network.MacAddress, 0); - return; - } - /* update WMM, ERP in the beacon */ - /* todo: the timer is used instead of the number of the beacon received= */ - if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) - update_beacon_info(padapter, ie_ptr, ie_len, psta); - process_p2p_ps_ie(padapter, ie_ptr, ie_len); + if (!psta) + return; + + ret =3D rtw_check_bcn_info(padapter, pframe, len); + if (!ret) { + receive_disconnect(padapter, pmlmeinfo->network.MacAddress, 0); + return; } + /* update WMM, ERP in the beacon */ + /* todo: the timer is used instead of the number of the beacon received = */ + if ((sta_rx_pkts(psta) & 0xf) =3D=3D 0) + update_beacon_info(padapter, ie_ptr, ie_len, psta); + process_p2p_ps_ie(padapter, ie_ptr, ie_len); } else if ((pmlmeinfo->state & 0x03) =3D=3D WIFI_FW_ADHOC_STATE) { psta =3D rtw_get_stainfo(pstapriv, mgmt->sa); if (psta) { --=20 2.30.2 From nobody Sun Feb 8 11:46:42 2026 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 DBA2FC4321E for ; Sat, 26 Nov 2022 16:02:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229500AbiKZQCP (ORCPT ); Sat, 26 Nov 2022 11:02:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbiKZQBs (ORCPT ); Sat, 26 Nov 2022 11:01:48 -0500 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 B81D5193FB for ; Sat, 26 Nov 2022 08:01:47 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxcb-0000Ub-K2; Sat, 26 Nov 2022 17:01:41 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 10/10] staging: r8188eu: remove a variable Date: Sat, 26 Nov 2022 17:01:29 +0100 Message-Id: <20221126160129.178697-11-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Check the result of rtw_check_bcn_info directly and remove the ret variable. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 362313c49c52..d32b2d569e23 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -555,7 +555,6 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) u8 *pframe =3D precv_frame->rx_data; uint len =3D precv_frame->len; struct wlan_bssid_ex *pbss; - int ret =3D _SUCCESS; u8 *ie_ptr; u32 ie_len; =20 @@ -600,8 +599,7 @@ static void OnBeacon(struct adapter *padapter, struct r= ecv_frame *precv_frame) if (!psta) return; =20 - ret =3D rtw_check_bcn_info(padapter, pframe, len); - if (!ret) { + if (rtw_check_bcn_info(padapter, pframe, len) !=3D _SUCCESS) { receive_disconnect(padapter, pmlmeinfo->network.MacAddress, 0); return; } --=20 2.30.2