From nobody Fri Sep 19 09:05:05 2025 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 42692C4332F for ; Mon, 7 Nov 2022 20:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232517AbiKGU2y (ORCPT ); Mon, 7 Nov 2022 15:28:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232934AbiKGU2r (ORCPT ); Mon, 7 Nov 2022 15:28: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 581DA205FA for ; Mon, 7 Nov 2022 12:28:46 -0800 (PST) Received: from ipservice-092-217-067-198.092.217.pools.vodafone-ip.de ([92.217.67.198] 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 1os8jW-0004bP-PW; Mon, 07 Nov 2022 21:28: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 , Dan Carpenter Subject: [PATCH v2 1/3] staging: r8188eu: use a qos_hdr in validate_recv_data_frame Date: Mon, 7 Nov 2022 21:28:22 +0100 Message-Id: <20221107202824.61431-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107202824.61431-1-martin@kaiser.cx> References: <20221107202824.61431-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_qos_hdr in the validate_recv_data_frame function. Use this struct to replace some numeric offsets and make the code easier to understand. Reported-by: Dan Carpenter Signed-off-by: Martin Kaiser --- Changes in v2 - fixed hdrlen calculation drivers/staging/r8188eu/core/rtw_recv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r818= 8eu/core/rtw_recv.c index cb0f35d7ab98..5b0a66aebff1 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1032,7 +1032,6 @@ static int validate_recv_data_frame(struct adapter *a= dapter, struct recv_frame *precv_frame) { struct sta_info *psta =3D NULL; - u8 *ptr =3D precv_frame->rx_data; struct ieee80211_hdr *hdr =3D (struct ieee80211_hdr *)precv_frame->rx_dat= a; struct rx_pkt_attrib *pattrib =3D &precv_frame->attrib; struct security_priv *psecuritypriv =3D &adapter->securitypriv; @@ -1071,10 +1070,12 @@ static int validate_recv_data_frame(struct adapter = *adapter, pattrib->ack_policy =3D 0; /* parsing QC field */ if (pattrib->qos) { + struct ieee80211_qos_hdr *qos_hdr =3D (struct ieee80211_qos_hdr *)hdr; + pattrib->priority =3D ieee80211_get_tid(hdr); - pattrib->ack_policy =3D GetAckpolicy((ptr + 24)); - pattrib->amsdu =3D GetAMsdu((ptr + 24)); - pattrib->hdrlen =3D 26; + pattrib->ack_policy =3D GetAckpolicy(&qos_hdr->qos_ctrl); + pattrib->amsdu =3D GetAMsdu(&qos_hdr->qos_ctrl); + pattrib->hdrlen =3D sizeof(*qos_hdr); =20 if (pattrib->priority !=3D 0 && pattrib->priority !=3D 3) adapter->recvpriv.bIsAnyNonBEPkts =3D true; --=20 2.30.2