Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2394658rwb; Mon, 7 Nov 2022 12:46:23 -0800 (PST) X-Google-Smtp-Source: AMsMyM6iFCeIpb65P09JIZ8xuIv2DNMwcSADqPxN3cZA3jNKbp43ahb6MFPugRyqO5n8Xn3QubZ+ X-Received: by 2002:a17:907:7208:b0:78e:176e:e0c6 with SMTP id dr8-20020a170907720800b0078e176ee0c6mr49785539ejc.594.1667853983285; Mon, 07 Nov 2022 12:46:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667853983; cv=none; d=google.com; s=arc-20160816; b=rhyFtyYynKBOBPQH6NauBzhezgstt95eoHEtmjop8zLBCavgQebCskQk1IG42S2QhS o9gOh9MerM3MXgBHkKOVx5Gwzd9W41mP+ret5LI/FUNWF1+MxI9CT08vg3DeZNt1TrDJ 8PU/fjfOjEcbzLasmxEc474zWxw7yOUsRN3thXVdqs2/I4nJ0ejIhBfUFDCEya1KM4DJ B16UXO5T39GsRZEIn97RRWJrdQyusApKn3BhwwPaUQtRQrn5uy81iuIl3AYpOIytdRKI vUBrMDeaJaJe/odOWuXHmuKqmsqaUxwfEw9DFLhJjGGUvgT191uxthQDMD3maddd0/4s ilpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+wTRkpyHTc8BS0WuAcR23j0uN5DCcAjUjDhW1axvcvI=; b=a1YOrFnWH2KDNCuOg7oTFwSEapALrjlTFUTy3aD3h5aSyN+az0O0f8fG2UEZX0z5my VmtuWVCiyWz312kxi566rP+zeuKEAr6WbFeM/lbDhPPHjGg7LcOSIZtEdDeRvBs6eI5B l4/BCOqyiWqT4sDQeAyemIm6D5o2vWBNFx5v2Nj/Zt85CBPFPo4+CQR1N7YLmXzQ49Bd knNJpv28KeMxLYdlp5zcjLOU+G9UYFd+PtGzWHr8VHrdaMejl8dZKdBglyRV88UN08sk GuhxyukR/YWmcQDJt03s95yARLimUhchE0AqDe/k8Tp575fGMz5UZTqnElMwJgZ+bT8O ygrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ee49-20020a056402293100b00461992160edsi9225459edb.384.2022.11.07.12.45.59; Mon, 07 Nov 2022 12:46:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232944AbiKGU2x (ORCPT + 92 others); Mon, 7 Nov 2022 15:28:53 -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: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/r8188eu/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 *adapter, struct recv_frame *precv_frame) { struct sta_info *psta = NULL; - u8 *ptr = precv_frame->rx_data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct security_priv *psecuritypriv = &adapter->securitypriv; @@ -1071,10 +1070,12 @@ static int validate_recv_data_frame(struct adapter *adapter, pattrib->ack_policy = 0; /* parsing QC field */ if (pattrib->qos) { + struct ieee80211_qos_hdr *qos_hdr = (struct ieee80211_qos_hdr *)hdr; + pattrib->priority = ieee80211_get_tid(hdr); - pattrib->ack_policy = GetAckpolicy((ptr + 24)); - pattrib->amsdu = GetAMsdu((ptr + 24)); - pattrib->hdrlen = 26; + pattrib->ack_policy = GetAckpolicy(&qos_hdr->qos_ctrl); + pattrib->amsdu = GetAMsdu(&qos_hdr->qos_ctrl); + pattrib->hdrlen = sizeof(*qos_hdr); if (pattrib->priority != 0 && pattrib->priority != 3) adapter->recvpriv.bIsAnyNonBEPkts = true; -- 2.30.2