Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2393169rwb; Mon, 7 Nov 2022 12:45:14 -0800 (PST) X-Google-Smtp-Source: AMsMyM7/KYzM4plGK9d+A/t+D2VhS5PKeikmjC3n67LJR2YmGm+dQ8mkvxrXYYQ6ZouL0OQ3Icxk X-Received: by 2002:a17:907:96a0:b0:7ad:960d:1789 with SMTP id hd32-20020a17090796a000b007ad960d1789mr50474910ejc.305.1667853913967; Mon, 07 Nov 2022 12:45:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667853913; cv=none; d=google.com; s=arc-20160816; b=Ai2zZiI2R26yIo5ne9Srb9LBhZkWiPeMP/Q04VGn712ml/r+0Ce8jDMnAirAyVzIuF AJlahDdQbwzcv1BBEivk7UIG0D+DirEinEFPrf+VMwaWjWQxQ7qocDvb3Zd7RdH4b98B 09QAbfNTMZgcZu5L4NjNw4lx5Ju6R7j41AAlwuI28MC6h3glYXG+Q9z6POlhrkYYoL38 p1ih7ebDxJhz/RGPHwn9Z+D+0Qc1yFoVDvk5s7ij4+MMqtUdCazbsIgbESDyZ3iX7rh5 u2aY/rVKuFTBCzuwroYa30ZX1h2a7z+lG3r5AWGvyvBlz8SqHTdeNxsNqB1mReo3hYFi h91w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ClljEksGBlK1RCeu79GCsDFEAYwmq2ipsCvBMnFRabk=; b=CjvMxWEyWHoCMG+K8vL2u8IsdgFT6RVkfA2LM3uUPpEFxFTsgIUKeW8ZOy7T/3TiAk EfbJGcsBKSJiXpVUr624QB45lNfqUYonGZNZPWAZ4opLDfhQM/ofv+2rTTRrxlqECXEF /xgLEQDMtn//nRx2mC2YdprXgFhzhIZ/66oZmqKOkVi6bU3E+oRHc4FGhjLRWbAPcW/9 WTtPjj/XpLjGWnf+LCWSEo5bwNrwU4/4fHB6AyVb8w6HfCr01mzFN71ht27xocJhZ/0T utCjVLzR3yUot1908K+GHXc8YPH4+MuK8OSAbLVeFmeiOQdeUJUm4DH1X32U/6pj8Pb5 XZkQ== 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 hb36-20020a170907162400b007940226fd21si11597141ejc.903.2022.11.07.12.44.47; Mon, 07 Nov 2022 12:45:13 -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 S232912AbiKGU2I (ORCPT + 92 others); Mon, 7 Nov 2022 15:28:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232895AbiKGU1w (ORCPT ); Mon, 7 Nov 2022 15:27:52 -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 7F8F66413 for ; Mon, 7 Nov 2022 12:27:50 -0800 (PST) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1os8ie-0004af-G3; Mon, 07 Nov 2022 21:27:44 +0100 Date: Mon, 7 Nov 2022 21:27:44 +0100 From: Martin Kaiser To: Dan Carpenter Cc: Greg Kroah-Hartman , Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] staging: r8188eu: use a qos_hdr in validate_recv_data_frame Message-ID: <20221107202744.cn6t5apcny7jfetp@viti.kaiser.cx> References: <20221106170455.743058-1-martin@kaiser.cx> <20221106170455.743058-2-martin@kaiser.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: Martin Kaiser 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 Thus wrote Dan Carpenter (error27@gmail.com): > On Sun, Nov 06, 2022 at 06:04:53PM +0100, Martin Kaiser wrote: > > 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. > > Signed-off-by: Martin Kaiser > > --- > > 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..245b931c483d 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); > ^^^^ > Why did this change from "=" to "+="? Thanks a lot for spotting this, Dan! I tried a couple of versions, some of which used +=. For the one I submitted, this is wrong, of course. All of pattrib is initialised to 0 in update_recvframe_attrib_88e and pattrib->hdrlen is not updated until the assignment above. That's why the += still works and testing didn't show the problem. v2 is on the way... Thanks again, Martin