staging: r8188eu: simplify the calculation of ie start offset
authorMartin Kaiser <martin@kaiser.cx>
Sat, 6 Aug 2022 11:13:52 +0000 (13:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Aug 2022 13:16:41 +0000 (15:16 +0200)
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.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220806111352.690650-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme_ext.c

index 10074355b82d6d85027237a8c40beef2987e3416..6d3d5ff9a00e84950de5f55fe7d5b8c6739da4ed 100644 (file)
@@ -1359,7 +1359,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct 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 = (6 + WLAN_HDR_A3_LEN); i < pkt_len;) {
+       for (i = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); i < pkt_len;) {
                pIE = (struct ndis_802_11_var_ie *)(pframe + i);
 
                switch (pIE->ElementID) {