aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2022-06-02 21:37:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-06 08:08:35 +0200
commitd8f2cff63249fdf7f2cf78e70344613db1fc4e53 (patch)
treeb90f61f8084654d7e89b921cba05b183dc28b49d /drivers/staging
parentstaging: r8188eu: clarify the contents of the delba params (diff)
downloadlinux-dev-d8f2cff63249fdf7f2cf78e70344613db1fc4e53.tar.xz
linux-dev-d8f2cff63249fdf7f2cf78e70344613db1fc4e53.zip
staging: r8188eu: calculate the delba length
Use offsetofend to calculate the length of the delba message. We are now calculating all message lengths based on the offset of their last field. All intermediate updates of pattrib->pktlen can be removed. Tested-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20220602193726.280922-10-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/r8188eu/core/rtw_mlme_ext.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 049c206fb72a..aaf6a2e5c52c 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -5401,10 +5401,7 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch
mgmt->seq_ctrl = cpu_to_le16(pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
- pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
-
mgmt->u.action.category = WLAN_CATEGORY_BACK;
- pattrib->pktlen++;
switch (action) {
case WLAN_ACTION_ADDBA_REQ:
@@ -5448,14 +5445,12 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch
break;
case WLAN_ACTION_DELBA:
mgmt->u.action.u.delba.action_code = WLAN_ACTION_DELBA;
- pattrib->pktlen++;
mgmt->u.action.u.delba.params = cpu_to_le16((status & 0x1F) << 3);
params = u16_encode_bits((status & 0x1), IEEE80211_DELBA_PARAM_INITIATOR_MASK);
params |= u16_encode_bits((status >> 1) & 0xF, IEEE80211_DELBA_PARAM_TID_MASK);
mgmt->u.action.u.delba.params = cpu_to_le16(params);
- pattrib->pktlen += 2;
mgmt->u.action.u.delba.reason_code = cpu_to_le16(WLAN_STATUS_REQUEST_DECLINED);
- pattrib->pktlen += 2;
+ pattrib->pktlen = offsetofend(struct ieee80211_mgmt, u.action.u.delba.reason_code);
break;
default:
break;