From nobody Sat Apr 11 21:29:12 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 3CD6EC25B0C for ; Sat, 6 Aug 2022 11:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241850AbiHFLOd (ORCPT ); Sat, 6 Aug 2022 07:14:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234864AbiHFLOQ (ORCPT ); Sat, 6 Aug 2022 07:14:16 -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 0959011806 for ; Sat, 6 Aug 2022 04:14:15 -0700 (PDT) Received: from dslb-188-097-043-167.188.097.pools.vodafone-ip.de ([188.97.43.167] 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 1oKHkw-0001FX-PE; Sat, 06 Aug 2022 13:14:10 +0200 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 v2 5/5] staging: r8188eu: simplify the calculation of ie start offset Date: Sat, 6 Aug 2022 13:13:52 +0200 Message-Id: <20220806111352.690650-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220806111352.690650-1-martin@kaiser.cx> References: <20220724153917.138848-1-martin@kaiser.cx> <20220806111352.690650-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" Use offsetof to calculate the start offset of the information elements in an association response message. This should make it easier to understand how the offset is calculated. Signed-off-by: Martin Kaiser --- v2: - rewrite the commit message 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 10074355b82d..6d3d5ff9a00e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1359,7 +1359,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, str= uct recv_frame *precv_frame /* following are moved to join event callback function */ /* to handle HT, WMM, rate adaptive, update MAC reg */ /* for not to handle the synchronous IO in the tasklet */ - for (i =3D (6 + WLAN_HDR_A3_LEN); i < pkt_len;) { + for (i =3D offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); i < pk= t_len;) { pIE =3D (struct ndis_802_11_var_ie *)(pframe + i); =20 switch (pIE->ElementID) { --=20 2.30.2