From patchwork Sun Oct 30 17:33:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13016 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1893736wru; Sun, 30 Oct 2022 10:35:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5y2Fd+vMgrUEdhMqyj3NbiBWizK8bQogAlJ1XRcljp3Cp0ASBpRsovFcZAPFCYNzi1pWL7 X-Received: by 2002:a17:907:daa:b0:78d:9bc9:7d7a with SMTP id go42-20020a1709070daa00b0078d9bc97d7amr8913322ejc.567.1667151317086; Sun, 30 Oct 2022 10:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151317; cv=none; d=google.com; s=arc-20160816; b=S4zveQiTQarjiWV1p7uXEBdXQhZZSZabfGeUjyT/8t0BV2qqf0lz1ZpCFSJwBk3Iog 254ovZpYSJ59OKu/KJLcHavfzasesNkX5EgxCauJ85SDjDK0IpI+xU5FSsBKMItFfSou H9HTRzRofyeBsFQ2PIB3J7kWZsK2g2DWMN8CVccispc7C/BLwrX/Zp1EaMbeBa3QTUwU flc+QrgRajt77wJMNNsUtTUeCu8W0VQOgG5riT4fTWBUMJluB7Qc3bXiQuW4jiELqjNv 2FU59E8/QVKnfjIuCyzvitb3r5QcOd/9EXD2ySANf0D1HAWezbczWRM0Jf9PcbDsCh/W 24Rg== 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=+4nFpzvycB+rWza2dr2Uynel0dTJ66Cwt69EkBFU7MY=; b=iyfTCwC0O0EyCCMzKsmJBEPJ74iVotNl2jjXLxKwaDR6/mSkwCufAvwB8v32jbyzvp 8WpEqrMjV1P9aI75G+Rp/mfmoPRDWBkznZ4bbGfnSf2MN+gzNB4XURYJRHs2nXmikBnO +pH7FFmAdq3WVfmtCLSXS/aYjY72cawo5Bj6uFfpH+cWNrWHRs2khIAgnKv80+KASVSo L8xmmk/AaXKsY3fUyOxEh1FG5l1WceAoeUwigtjXWvvERXbKVFuYZwzeKEFqOG+O1oWR k9Oj2P9uI+e8qlaYsxc0F+6X8r4Uz/GddanSO1qp498oRJal2ZABJoeuwN7VQ7yZR4ZU DCGQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a17090699c400b007a8dddc7ec8si5012423ejn.382.2022.10.30.10.34.53; Sun, 30 Oct 2022 10:35:17 -0700 (PDT) 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 S229822AbiJ3Rdv (ORCPT + 99 others); Sun, 30 Oct 2022 13:33:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiJ3Rdu (ORCPT ); Sun, 30 Oct 2022 13:33:50 -0400 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 3165595B4 for ; Sun, 30 Oct 2022 10:33:46 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBp-000469-NY; Sun, 30 Oct 2022 18:33:41 +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 Subject: [PATCH v2 01/13] staging: r8188eu: replace a GetAddr1Ptr call Date: Sun, 30 Oct 2022 18:33:14 +0100 Message-Id: <20221030173326.1588647-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134859644250071?= X-GMAIL-MSGID: =?utf-8?q?1748134859644250071?= Define a struct ieee80211_mgmt and use it to read the destination address. This replaces one call to the driver-specific GetAddr1Ptr function, which should eventually be removed. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 127dbc4e8b9a..5a366688a3f7 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3815,13 +3815,14 @@ static unsigned int on_action_public_default(struct recv_frame *precv_frame) unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv_frame) { + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; unsigned int ret = _FAIL; u8 *pframe = precv_frame->rx_data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); u8 category, action; /* check RA matches or not */ - if (memcmp(myid(&padapter->eeprompriv), GetAddr1Ptr(pframe), ETH_ALEN)) + if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) goto exit; category = frame_body[0]; From patchwork Sun Oct 30 17:33:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13019 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1893868wru; Sun, 30 Oct 2022 10:35:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74iCD0xP6PJfCgniorZxyu2HUSyv9l5mmsj9WD994fQy+WeyuVu55cLTJ+IH9+5/GQDLqp X-Received: by 2002:a05:6402:5406:b0:452:1560:f9d4 with SMTP id ev6-20020a056402540600b004521560f9d4mr9767049edb.333.1667151336293; Sun, 30 Oct 2022 10:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151336; cv=none; d=google.com; s=arc-20160816; b=HN+tPU26y3bviN39mIA2+D4pV2lEbntWFyGjvy5obVyYsLBm28PSNRN/BEtsAXeKsM 1GNrvMx0tJ53yyqypZJZ+A144oKX7tv8zP+cV0Sg3UN4ZluJYHeNjAg2KNbe6Klvzejl uFDbrDHT89oMy381JzxQ/GVIzeQiE1NkaOpgKJHyxHeGSHThdwejKIh3ptv0o8kSox8I QqTsEOHBLSfJciKr+oZKKkSU6DWJgL/sIDPf0zfx8FOTXnLztR38zGv7eI21jeF0wzDW gj+8gPs36dSii5bnkukMNdIfkfL8L7QrZhGrTQfKr4EZfk0+B5EHtF4iElwg2EFo3QmT WqVg== 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=c/etGoh4+SPCqPzmtQ82eLnf8KVfmpLT/m+vzxeS/9Y=; b=AmFUpuVUJtAnqL6dDo6a7tfNMImQjUJ3qY3TtanJWf7rIEIbBl6Y2t1GZrQ2nVSLIb x2yB16ZAfyq80Mt3RyJvzfGz1APXjvTWGmJNJCjY8uoRqV/ehuDFyAbxUkrDH7b0VxQf PWGzjrZXmUKcMcPiDxZld6Y8ZwGUZ94BwVsA322BBg4tRA1pebW3CEEWftcD69PElqlY oaqSFV1rkXvBVE1nJChuZtfx2/iLTgC3xJ17aRgQaS4/3NM8wf8CuARtBXhFnBMaOgQF aDCFZ7RUcv7oCp5ibsIlm//0qJ2tkW6muH1B6KRWSJ9+clTaXG8+t3iHDi7b0bwUPf2w Rd9Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8-20020a170906b00800b0078d23ac6981si3924759ejy.790.2022.10.30.10.35.13; Sun, 30 Oct 2022 10:35:36 -0700 (PDT) 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 S229968AbiJ3ReB (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbiJ3Rdv (ORCPT ); Sun, 30 Oct 2022 13:33:51 -0400 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 3B688A44C for ; Sun, 30 Oct 2022 10:33:46 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBq-000469-If; Sun, 30 Oct 2022 18:33:42 +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 Subject: [PATCH v2 02/13] staging: r8188eu: remove duplicate category check Date: Sun, 30 Oct 2022 18:33:15 +0100 Message-Id: <20221030173326.1588647-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134879404865532?= X-GMAIL-MSGID: =?utf-8?q?1748134879404865532?= The caller of on_action_public has already checked the action category. We can remove the check in on_action_public. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 5a366688a3f7..7d4f208d161b 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3819,16 +3819,12 @@ unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv unsigned int ret = _FAIL; u8 *pframe = precv_frame->rx_data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); - u8 category, action; + u8 action; /* check RA matches or not */ if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) goto exit; - category = frame_body[0]; - if (category != WLAN_CATEGORY_PUBLIC) - goto exit; - action = frame_body[1]; switch (action) { case ACT_PUBLIC_VENDOR: From patchwork Sun Oct 30 17:33:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1893825wru; Sun, 30 Oct 2022 10:35:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ivlyx9MIObVHAQiMnyRrV0nndr/ye9RxRCk4wKqaw1Jcv89i88RfqjMzUtr6AhHVxNgIe X-Received: by 2002:a05:6402:754:b0:463:67da:3dc with SMTP id p20-20020a056402075400b0046367da03dcmr226020edy.386.1667151330861; Sun, 30 Oct 2022 10:35:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151330; cv=none; d=google.com; s=arc-20160816; b=utXjUG+4UrIfCEcoq5ROU0cgv1YAmk1fTfun9jPXbgvJwlaTcJcSHi1xyXu31gUrdh bxRbw/HcoQjvnc7IMHsXER1KJNQb8+xr7nasfOOwIWvW7+h1Nr6LSgWC7xSXMm/c5cy5 T4Ttbv0nI/0y9Op66pTElmAiWw0CUEhf/KM63+9vaqwXHgYrs3nzy0b53O/NfBsWTxzm r9QwUIOdppon2Y70tETmsY9vttSU6rmfud70infk55uwEzWnkPIFml/Vw6xRv+6jJyEt b6Au4bZ00Yl5svrLz8Mb+x+Vr2vAixfw4Xky3RcQ2OZCmV07hro6UIiz+Tavsxa1wLUF aJ5Q== 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=xCEcp18//YE086VSvtL86zS8Pm8mPtasIbifESGLIJI=; b=JlTidy822rIlkG8loPmzIUa7Z/53TGcpIdRlTcskIpS3IVzLXPdkUh0fnFBAU9FWcr X5cSgy3JEY2C7S6Kh6IIBCTus/NsTJEG3aVr9DUpV8UmMAnpAXtu3q+QkIm3XLO+R42V 2NbQYFl+5msgvT0jkUFZwO4L/dpd9fX+enHBlQY9iWV9yucq1+QoIEPVHkMH3/fV3Vsr QItYGxNQsmqCdMxWd50zzy658i1xo9lHmbwVQwOV3MvijEUE11UHPKKUx+GNYpUpwV/E rIlRT0xtAL/oVD6pCAIZ8uSI3pnfvT9u4foAUadqwK7ULnPrArAAI+qcE+ak20EA+dYq ngtA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw23-20020a1709066a1700b007adb388df38si5656944ejc.706.2022.10.30.10.35.07; Sun, 30 Oct 2022 10:35:30 -0700 (PDT) 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 S229912AbiJ3Rd6 (ORCPT + 99 others); Sun, 30 Oct 2022 13:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiJ3Rdv (ORCPT ); Sun, 30 Oct 2022 13:33:51 -0400 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 41772A44D for ; Sun, 30 Oct 2022 10:33:47 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBr-000469-CG; Sun, 30 Oct 2022 18:33:43 +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 , kernel test robot Subject: [PATCH v2 03/13] staging: r8188eu: make on_action_public static void Date: Sun, 30 Oct 2022 18:33:16 +0100 Message-Id: <20221030173326.1588647-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134874044668358?= X-GMAIL-MSGID: =?utf-8?q?1748134874044668358?= The on_action_public function is called only by OnAction. This function also lives in rtw_mlme_ext.c and does not check the return value from on_action_public. We can make on_action_public a static void function. The ret variable is no longer needed if we don't return a value. It can be removed. Reported-by: kernel test robot Signed-off-by: Martin Kaiser --- Changes in v2 - remove ret variable, it was written but never read drivers/staging/r8188eu/core/rtw_mlme_ext.c | 12 ++++-------- drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 -- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 7d4f208d161b..88600f62ffb4 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3813,30 +3813,26 @@ static unsigned int on_action_public_default(struct recv_frame *precv_frame) return ret; } -unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv_frame) +static void on_action_public(struct adapter *padapter, struct recv_frame *precv_frame) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; - unsigned int ret = _FAIL; u8 *pframe = precv_frame->rx_data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); u8 action; /* check RA matches or not */ if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) - goto exit; + return; action = frame_body[1]; switch (action) { case ACT_PUBLIC_VENDOR: - ret = on_action_public_vendor(precv_frame); + on_action_public_vendor(precv_frame); break; default: - ret = on_action_public_default(precv_frame); + on_action_public_default(precv_frame); break; } - -exit: - return ret; } unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame) diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h index c8beaa927cba..ec2e9352011b 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h @@ -538,8 +538,6 @@ void start_create_ibss(struct adapter *padapter); unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_frame); -unsigned int on_action_public(struct adapter *padapter, - struct recv_frame *precv_frame); unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame); From patchwork Sun Oct 30 17:33:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1893911wru; Sun, 30 Oct 2022 10:35:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM473P/HYJHoLuyKI+BgC2he+NoXovLX/o37Ds0PqquX1zY3bjwmC+cC2NZgaRT/98EWvXqu X-Received: by 2002:a05:6402:4443:b0:45f:ca04:719b with SMTP id o3-20020a056402444300b0045fca04719bmr9759839edb.171.1667151342419; Sun, 30 Oct 2022 10:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151342; cv=none; d=google.com; s=arc-20160816; b=QDQP17XOFZtYmyNrkWGrJYWXVbav0bUceb04VBQj5pxUkjXbxz7SwU6rekSJj03ioT Egd7HjqABuzkHSSYOMJBk0lRMjLNP1ry0UBM1QerPMA0K9biHVt7i3BJzHijzeDSyqe9 YI2d4kGECjYTBAVj9WHPA1OOFqvcV54M9u3O/oN0iLfmxXQ6jzTpMnzZjqODaM4XAUOU B4sX3z3JN2HU+pnGNPB5L759YqNfzOg7LaU4NI21PNlqwdwcxHgsIUEAuMXvvJHDUgBa w13+xl4Z/Wlb+YCxSkPGL3vRKU8AGuLbNAVkGwOTtcXZ3iwJ2ZbZonZ/FdxzQCsvyW87 Sh4g== 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=CKCwp0k3yOlqW29QYFcw+Ie0khMK4/o/shwmMiht4oY=; b=VY6kX4rrIOJRLFx0KXkr8L/8W/rIATizwZJLgUBSMIOBEzblQ0LtbvqniF3tkDbsp4 zj1Tf11pBOZt0QEK10OsnvOy3i/ci5GrYInWHyljFcArOpsz1K2W8BvWRjMRFnlmg7XX f+g/Q1CRcDfCHxyiUxgD2NM8RFHCd+MqHaNoC3SobVOPMGUTC6J6cQk+ySWcV12UcyrM h9/WE5m0UWtTOgDqSuJ0NMNoJ5xwt05AzzCeUJzXwE+H8FeFCsdeYwEbVrski4W151b5 Ir7AWdrj/tJkTOPB3qZ8zjV56DMxWkz/nkyb3UBqFvxwLT9fGd9qkaNACmvFELP4bKt+ fipQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg39-20020a170907a42700b0079e1916c11asi5688030ejc.703.2022.10.30.10.35.19; Sun, 30 Oct 2022 10:35:42 -0700 (PDT) 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 S229875AbiJ3ReG (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229817AbiJ3Rdv (ORCPT ); Sun, 30 Oct 2022 13:33:51 -0400 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 76953A450 for ; Sun, 30 Oct 2022 10:33:49 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBs-000469-4C; Sun, 30 Oct 2022 18:33:44 +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 Subject: [PATCH v2 04/13] staging: r8188eu: make OnAction_back static void Date: Sun, 30 Oct 2022 18:33:17 +0100 Message-Id: <20221030173326.1588647-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134885787328207?= X-GMAIL-MSGID: =?utf-8?q?1748134885787328207?= OnAction_back is called only by OnAction, its return value is not checked. We can make it a static void function. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 13 +++++-------- drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 -- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 88600f62ffb4..779c022b1c50 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1481,7 +1481,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) pmlmepriv->LinkDetectInfo.bBusyTraffic = false; } -unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_frame) +static void OnAction_back(struct adapter *padapter, struct recv_frame *precv_frame) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; struct sta_info *psta = NULL; @@ -1494,21 +1494,20 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr struct sta_priv *pstapriv = &padapter->stapriv; /* check RA matches or not */ if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))/* for if1, sta/ap mode */ - return _SUCCESS; + return; if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE) if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) - return _SUCCESS; + return; psta = rtw_get_stainfo(pstapriv, mgmt->sa); - if (!psta) - return _SUCCESS; + return; frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); if (!pmlmeinfo->HT_enable) - return _SUCCESS; + return; /* All union members start with an action code, it's ok to use addba_req. */ switch (mgmt->u.action.u.addba_req.action_code) { case WLAN_ACTION_ADDBA_REQ: @@ -1550,8 +1549,6 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr default: break; } - - return _SUCCESS; } static int get_reg_classes_full_count(struct p2p_channels *channel_list) diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h index ec2e9352011b..4ccdce1ad9be 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h @@ -536,8 +536,6 @@ void start_clnt_auth(struct adapter *padapter); void start_clnt_join(struct adapter *padapter); void start_create_ibss(struct adapter *padapter); -unsigned int OnAction_back(struct adapter *padapter, - struct recv_frame *precv_frame); unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame); From patchwork Sun Oct 30 17:33:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1893764wru; Sun, 30 Oct 2022 10:35:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QHfIp2GiY7dctGcgcPjyPa1GhB/ttoJYsacdjUnmf+5PzPXh8qF4W2ohuEAR+ECm49Piw X-Received: by 2002:a17:907:320b:b0:780:280:7b72 with SMTP id xg11-20020a170907320b00b0078002807b72mr9478087ejb.146.1667151322736; Sun, 30 Oct 2022 10:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151322; cv=none; d=google.com; s=arc-20160816; b=UT8gB/iY89myg/QvIsVYHMw4I/gCLyDIVniB5lZbN4caayclXL6lNIW/BbF65OPnUh 9kEWWPyGQo8EJmUUXqf9d+VHTm+Y5DcaBo1KTjc25lztV65esk+vNtpJj5VoIU1kGV0X WYVL32iGpTDUrtPtzAFa6Lf+ATwp268Sn1NyK9qQILpzkdCPScdJxWOAjKvbCNtjMods 3XyBO56bmSuG0EpYH9E3EAom4pz6yX5fcu1mjbHMn/zM93auzJWuVPwkG92J8uEgqb7F chnj6T6nUWDsACPiiLH+C8JMLWXF9p4xIWd2kgKTGbxQ1TQtqynCYetc3rwso1bHaAoc nZQw== 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=qyba2Ig+jVP7BUOA36O0mPLoBBSVzNOJG+c6hudpY88=; b=BUfyi0RUUbURc1ltVimmGXn+no08bfLiG4fVaAwBChE4jHZav31FwtI2YtPQ/SlLZR iLFE2mW5kB9aaqm1fyLcDY+PjeMoxmAolYyC4sGJs8drS9DMRuX8wIakttn678pq2t4R VsTbpkgjqnr76kOIK1NHw1U/JIz3w/y9W4Xsx7hBmMh7Wl/sb0leBwlus1A2EUoizsgd l5v92ajHcOsWGXmGlg6zxd2mPIRCDS7TPp3gKIyhMCzv7GLrxg62AJ1XDN4dFipfUF4k Rdg/pO0ROmKd0LmZm0r4DWcHxJyETl9/B+2dmr1dIL4zQ7E/VbIJ1KWsPNpC3exrPDtz Ht4Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a056402033600b00461d9b46883si4683241edw.519.2022.10.30.10.34.59; Sun, 30 Oct 2022 10:35:22 -0700 (PDT) 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 S229885AbiJ3Rdz (ORCPT + 99 others); Sun, 30 Oct 2022 13:33:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbiJ3Rdv (ORCPT ); Sun, 30 Oct 2022 13:33:51 -0400 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 6E8D2A44F for ; Sun, 30 Oct 2022 10:33:49 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBs-000469-TO; Sun, 30 Oct 2022 18:33:44 +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 Subject: [PATCH v2 05/13] staging: r8188eu: make OnAction_p2p static void Date: Sun, 30 Oct 2022 18:33:18 +0100 Message-Id: <20221030173326.1588647-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134865555326032?= X-GMAIL-MSGID: =?utf-8?q?1748134865555326032?= OnAction_p2p is called only by OnAction, its return value is not checked. We can make it a static void function. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 9 ++++----- drivers/staging/r8188eu/include/rtw_mlme_ext.h | 3 --- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 779c022b1c50..f1054192bfb1 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3832,7 +3832,7 @@ static void on_action_public(struct adapter *padapter, struct recv_frame *precv_ } } -unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame) +static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame) { u8 *frame_body; u8 category, OUI_Subtype; @@ -3842,16 +3842,16 @@ unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fra /* check RA matches or not */ if (memcmp(myid(&padapter->eeprompriv), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */ - return _SUCCESS; + return; frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); category = frame_body[0]; if (category != RTW_WLAN_CATEGORY_P2P) - return _SUCCESS; + return; if (be32_to_cpu(*((__be32 *)(frame_body + 1))) != P2POUI) - return _SUCCESS; + return; len -= sizeof(struct ieee80211_hdr_3addr); OUI_Subtype = frame_body[5]; @@ -3869,7 +3869,6 @@ unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fra default: break; } - return _SUCCESS; } static void OnAction(struct adapter *padapter, struct recv_frame *precv_frame) diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h index 4ccdce1ad9be..ce5b57e23e53 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h @@ -536,9 +536,6 @@ void start_clnt_auth(struct adapter *padapter); void start_clnt_join(struct adapter *padapter); void start_create_ibss(struct adapter *padapter); -unsigned int OnAction_p2p(struct adapter *padapter, - struct recv_frame *precv_frame); - void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res); void mlmeext_sta_del_event_callback(struct adapter *padapter); void mlmeext_sta_add_event_callback(struct adapter *padapter, From patchwork Sun Oct 30 17:33:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1893989wru; Sun, 30 Oct 2022 10:35:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4b97rQex59XiqkWqbppd2M+9cYAZtqNIrozA7X4ywhXW/28p+cR37JTg1rPYTCou6gpG0B X-Received: by 2002:a17:907:c03:b0:781:fd5a:c093 with SMTP id ga3-20020a1709070c0300b00781fd5ac093mr9122265ejc.89.1667151351623; Sun, 30 Oct 2022 10:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151351; cv=none; d=google.com; s=arc-20160816; b=jMn/1TzpC0U3TPyOAdmoeJvE0VQjlXfiOYBD0wanwfialBLNC5z+sR4UBCztJw3Wx9 gfVubJf8/8wKo8g+kUuj5LYrCHakTtXljOIMRQUQxphgiG5AX8rEO/BK5jjpc5tz3nB6 fSHaQ0cfCxv0DYp9B5EQZu55iGouzAIwsPwSZ7N6ABCC5HaaOc68vYJ4YRffGV664IzD oYpRbAtfefjM4oMYZJqVKabVEplzc7eFFDstWxPgPdqakNle57FlcImkx3oMYWdb4UnL /lnGCAeo+N7wn3D5BJj/Ok6UCj3y1kBRJlqNBptGJ/nOc1Y+ZbmonENHL0lkyKaQBeFF ty4g== 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=FIPzMOo/7ZY4X/JJTF9vCJkO6336Krn30eUPwsuZ/Do=; b=SeDfEwM261ggro+SJL4yJbBZvkK+2843EBp2Auel4SfnjKEMMHrPulSRQRwpp/C7+S swgZEUUjG/xPnC/iMCMlxUJT36xFWNepJ3bhR9iBHJmfJ8GHwIiGAfxa+ECc9nNpFULc DDZajSjiZEi6qIhUt+8yw2NiOJExLY0XmKielIK2uaJ54ws4wJtAOLyLJPIjF6iHfvrd ChXV0xBRqsQt1hq5kjEcrmTGtRqJ6+0yCx9ilOnekZicyazTNkKoZ4AnSr0H1K4xqQzp iYClQxeu1ebk4kZH11OQzotpTOZFQJlSjuU2juPLJIC+qaTo7g7ekKoLQkmG7RJKkVLJ a25A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d25-20020a170906175900b0078b85fdf4e4si4264328eje.532.2022.10.30.10.35.28; Sun, 30 Oct 2022 10:35:51 -0700 (PDT) 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 S229927AbiJ3ReN (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229826AbiJ3Rdv (ORCPT ); Sun, 30 Oct 2022 13:33:51 -0400 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 463B495B4 for ; Sun, 30 Oct 2022 10:33:51 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBt-000469-Le; Sun, 30 Oct 2022 18:33:45 +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 Subject: [PATCH v2 06/13] staging: r8188eu: remove category check in OnAction_p2p Date: Sun, 30 Oct 2022 18:33:19 +0100 Message-Id: <20221030173326.1588647-7-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134895726168967?= X-GMAIL-MSGID: =?utf-8?q?1748134895726168967?= The caller of OnAction_p2p has already checked the action category. We can remove the check in OnAction_p2p. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index f1054192bfb1..efcb2f3b6d3f 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3835,7 +3835,7 @@ static void on_action_public(struct adapter *padapter, struct recv_frame *precv_ static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame) { u8 *frame_body; - u8 category, OUI_Subtype; + u8 OUI_Subtype; u8 *pframe = precv_frame->rx_data; uint len = precv_frame->len; struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -3846,10 +3846,6 @@ static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fram frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); - category = frame_body[0]; - if (category != RTW_WLAN_CATEGORY_P2P) - return; - if (be32_to_cpu(*((__be32 *)(frame_body + 1))) != P2POUI) return; From patchwork Sun Oct 30 17:33:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13021 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1893942wru; Sun, 30 Oct 2022 10:35:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/VWCgVUBMv6K2BNvCoJSwUdYiWXM9KKCxOit0PYV9qnq8r+dG1jvDwFjws085EO2qT7xt X-Received: by 2002:aa7:c452:0:b0:463:14dd:2093 with SMTP id n18-20020aa7c452000000b0046314dd2093mr6562019edr.48.1667151344949; Sun, 30 Oct 2022 10:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151344; cv=none; d=google.com; s=arc-20160816; b=g0HA/vN0ZjD5viu8I7yGVPY9sE8JzGgNuTIjHr+7YuxyCgpvN6GmRwWw0dp3Bq1WAk TdgcA73rF6hrKlbcYyhUlIGVnbbSKf6XML1rNf/VswZ9kw3SoyTt+SSivEelukqH6xoe NYxKb9C+LYXST6zU38DvGhIxW3EKaZwTaBCmxqDn6XVkuhX3i7dnsylT84zgxBJk1j58 h+6vYvoo3ta+nfYiYTy0BPic8vdlF8Mcu63IgU206JFy4qbQtBJRKuM0QZNoW9vmKnRW 1EmDORfOeFDRjudA9VdrvozvZqWyS5O4JjsX5EJ3M+DEkSpsnPWTnWMOcRKMGra2aXmR sOHw== 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=LjbJ83QlYCGAMKrFsZiaXWMAkA3amwSSLm0aE5hONyo=; b=WGkiyXJKJ8/Eeb/48/QmoNfSrz6sf8JVBnePyXmqc9XZSYgQ+uUMgAawn88F+Lh7hI sTCTNQwFvMr9pCZTfGtnID6niAU1XWqseDHmXihMJY5a4YeFGbzoHIGR2YVHgi8gJjzq 3rUYGRXCwVQzNZcFtKMVCHTbA+yUDhBK7FWW+sBDVhkJZCHG1Mbu9gVUztttceOUvwLI saKNV+8EkvOg6L+MhZ/5u3TW6zSiArMV2rDKQg5Xo6wusND2ZAG+EX0ZgGR5phg99sMR QIh+fLavgs83OVAtTZniedu4xhDbLk+IyPppq4h0Hj1A71nq27UVMBf5wJwyQpNxajMH mNCw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p23-20020a170906141700b0073083c63edcsi4672994ejc.306.2022.10.30.10.35.21; Sun, 30 Oct 2022 10:35:44 -0700 (PDT) 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 S229934AbiJ3ReJ (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229799AbiJ3Rdv (ORCPT ); Sun, 30 Oct 2022 13:33:51 -0400 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 5E4F4A44E for ; Sun, 30 Oct 2022 10:33:49 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBu-000469-Et; Sun, 30 Oct 2022 18:33:46 +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 Subject: [PATCH v2 07/13] staging: r8188eu: replace switch-case with if Date: Sun, 30 Oct 2022 18:33:20 +0100 Message-Id: <20221030173326.1588647-8-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134888378272016?= X-GMAIL-MSGID: =?utf-8?q?1748134888378272016?= OnAction_p2p has a switch-case statement where only a single case is handled. Use if instead, this makes the code shorter and easier to read. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index efcb2f3b6d3f..64d01da9c814 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3852,19 +3852,8 @@ static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fram len -= sizeof(struct ieee80211_hdr_3addr); OUI_Subtype = frame_body[5]; - switch (OUI_Subtype) { - case P2P_NOTICE_OF_ABSENCE: - break; - case P2P_PRESENCE_REQUEST: + if (OUI_Subtype == P2P_PRESENCE_REQUEST) process_p2p_presence_req(pwdinfo, pframe, len); - break; - case P2P_PRESENCE_RESPONSE: - break; - case P2P_GO_DISC_REQUEST: - break; - default: - break; - } } static void OnAction(struct adapter *padapter, struct recv_frame *precv_frame) From patchwork Sun Oct 30 17:33:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1894216wru; Sun, 30 Oct 2022 10:36:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WbYdNxAhABOU+lMV18Rhz6+77CwrT5BGk+VSlwnq7NLhiSm/z/2bNrHiA0vxusyhx4BSd X-Received: by 2002:a17:906:d550:b0:7ad:d2f1:dba5 with SMTP id cr16-20020a170906d55000b007add2f1dba5mr948744ejc.52.1667151390729; Sun, 30 Oct 2022 10:36:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151390; cv=none; d=google.com; s=arc-20160816; b=LL5CVYbVXDIVGxSPBeiJb0v6G7Gdhs/nOrhN5pYY6BShG3IUBLZvq9H0AMNlT6URIr 1M8AeUztafoccput/YpUThGnM8arrky/EVMGX+hCxVKuV7t4Jyi9i4VGthtamM+8gGvE lW854NfaSrBJ+tNSfKk0wb0dwwux5nLDssVK+IxgnJrTxqwAzbfCNV30MS+ZjYNCIi/e ySHtLxeZBmeHrAX9VPLNrHqaKGLpSChB3WCYN64yxh7zFD6/dNyi11wvEqyBA6u7Ms44 t80x3nWXhKQJQ1nPrGDsHx1DGFpOddFhRg09jTsz5wUhCX+B0Dun08dSQRkA9M01p9mb /2JA== 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=Jr1Pf/cAP0ppjRSAqASGtNYX03PHXCDu94XYIiGeu1k=; b=sUxRU5uyb3Ln04B0dLZum42uBHdGNoZbpWKZUXfybgfCTGq21NUHkiVWyt1wTZdXiu MueZwJrJFCP7V/FlNuAMhFcRXepoGThb4gJh7nx1E4bnaDkLx8blFduQabfjf9KeZ3xK JhMhQp1GuuKbQCZwBDaE2kJfeM5qLAkE3AF+pQOVvvo8wNggcKfJ460g0rHuNBQqfT1t InRx9JOADavGXQkI61qATlEUm7SJyPI5Vlf9Biifmsn4Jku1FJ21ii9mC5OS3603cvnC GD/SLsr0Giti/Tz0d02nZ1U1d7+Yo8kA9SSV4laR803/S7I6EQc+WiPxPrft1YbmY6Om mFcA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg6-20020a170907970600b007a6ec03b13bsi5999765ejc.799.2022.10.30.10.36.07; Sun, 30 Oct 2022 10:36:30 -0700 (PDT) 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 S229996AbiJ3ReY (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbiJ3Rdx (ORCPT ); Sun, 30 Oct 2022 13:33:53 -0400 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 BC3039FC8 for ; Sun, 30 Oct 2022 10:33:52 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBv-000469-7D; Sun, 30 Oct 2022 18:33:47 +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 Subject: [PATCH v2 08/13] staging: r8188eu: replace GetAddr1Ptr call in OnAction_p2p Date: Sun, 30 Oct 2022 18:33:21 +0100 Message-Id: <20221030173326.1588647-9-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134937117444624?= X-GMAIL-MSGID: =?utf-8?q?1748134937117444624?= Define a struct ieee80211_mgmt in OnAction_p2p and use it to check the destination address. This replaces a call to the driver-specific GetAddr1Ptr function. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 64d01da9c814..6d95d3bc23e6 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3834,6 +3834,7 @@ static void on_action_public(struct adapter *padapter, struct recv_frame *precv_ static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame) { + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; u8 *frame_body; u8 OUI_Subtype; u8 *pframe = precv_frame->rx_data; @@ -3841,7 +3842,7 @@ static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fram struct wifidirect_info *pwdinfo = &padapter->wdinfo; /* check RA matches or not */ - if (memcmp(myid(&padapter->eeprompriv), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */ + if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))/* for if1, sta/ap mode */ return; frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); From patchwork Sun Oct 30 17:33:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1894029wru; Sun, 30 Oct 2022 10:35:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Wh9PMsfYjSBKpB/ErclINxDvx9RleoQe6DVVbXFPhf1qU3y+q26vBbtvsCM0MaZkTnQ1S X-Received: by 2002:a05:6402:378c:b0:458:8053:6c5f with SMTP id et12-20020a056402378c00b0045880536c5fmr9547863edb.9.1667151357215; Sun, 30 Oct 2022 10:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151357; cv=none; d=google.com; s=arc-20160816; b=zrB/HWCJqTrnJDhap7YZ7JP9vdT/Q/vlBtfec5Uf7pNraE7iZZ+Yks64a25nK7jsv3 O49Cg1b3waFhTRErPj+pBPKJaKdDIPlaqhKw9MlGP/JolUhsQGfXprIvkTQ34pdtHi/d izEpnN0jtDnrYAze2rD8HZpXVOqcL+VXXYkjM+9AVN+FPoTewLebS3fPfzV+5CsVRNBA ZlMLPE4n65+08FLjv1GUy/Myd2vHhToHrFXLXRX37WLowWDKhEew6hcjdXblWkqFcTWS DZOF2+5x5q2Z3Mpdp/B0+6byLbFWXES5BTksnQARrqHSqj9+XCK06+622ViTNUhoqTTx U8uA== 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=Kt0K3G/Hsly6nqngiKMVj6xeO4zPe8E1y/y5D4Pkpek=; b=QRm2Olc5jBTVGBElWGvBYru8L0vQa+Lj/IC6kzZNmLI3RVRcjGvOvsvKtb+fAvB15x +wK+MexpaHb4lW+pdMB6PA168J7rfaa53Bodoq+UdMMUdCFlpnw/1BNmrzHx6sUMupSA 7OE0An8RDydIpn9zpkgnPoOCRaT0VVO8LvgPmay8NBETiZtWtV9Gi1bFHvMaXyDavIeS y/xgbRCqgKJ7nZrMnBcgUmEEcuYoI5KVL/qvRGa7wNJe25X9F6KygBoQ6gZgkAVSQaUC X7yHeMImblViuxfGpmQKG2+7LlK4znffWKgDoJ3F0HgshEMf9eCHONnSixUXjPjVimio y2Zw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb27-20020a1709076d9b00b0073866c0672asi6032561ejc.73.2022.10.30.10.35.33; Sun, 30 Oct 2022 10:35:57 -0700 (PDT) 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 S229961AbiJ3ReS (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbiJ3Rdw (ORCPT ); Sun, 30 Oct 2022 13:33:52 -0400 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 DE9A59FC8 for ; Sun, 30 Oct 2022 10:33:51 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBv-000469-UZ; Sun, 30 Oct 2022 18:33:48 +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 Subject: [PATCH v2 09/13] staging: r8188eu: clean up on_action_public Date: Sun, 30 Oct 2022 18:33:22 +0100 Message-Id: <20221030173326.1588647-10-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134901545062162?= X-GMAIL-MSGID: =?utf-8?q?1748134901545062162?= Use the struct mgmt to read the action_code. This is much simpler than parsing the message ourselves. Add a comment about reading the action code. All members of the action enum start with an action_code byte. It does not matter which member we use. Signed-off-by: Martin Kaiser --- Changes in v2 - don't remove the ret variable, it's already gone drivers/staging/r8188eu/core/rtw_mlme_ext.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 6d95d3bc23e6..b3cef3504ad3 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3813,23 +3813,16 @@ static unsigned int on_action_public_default(struct recv_frame *precv_frame) static void on_action_public(struct adapter *padapter, struct recv_frame *precv_frame) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; - u8 *pframe = precv_frame->rx_data; - u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); - u8 action; /* check RA matches or not */ if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) return; - action = frame_body[1]; - switch (action) { - case ACT_PUBLIC_VENDOR: + /* All members of the action enum start with action_code. */ + if (mgmt->u.action.u.s1g.action_code == WLAN_PUB_ACTION_VENDOR_SPECIFIC) on_action_public_vendor(precv_frame); - break; - default: + else on_action_public_default(precv_frame); - break; - } } static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame) From patchwork Sun Oct 30 17:33:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1894021wru; Sun, 30 Oct 2022 10:35:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VbZrp4eXNBkFkLGMAApZqfhlAPF7T7ge8Gqrq2gysOtAdZRHdgRIzVLd1ZHSRisCh/D2w X-Received: by 2002:a05:6402:12d1:b0:463:3f0c:be02 with SMTP id k17-20020a05640212d100b004633f0cbe02mr3546630edx.239.1667151356266; Sun, 30 Oct 2022 10:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151356; cv=none; d=google.com; s=arc-20160816; b=sgwuapV+LRXY0QpM9AqciBH7MGxSahs1oL/yimLfgWQX1U5CidBl1vpzwMlxlQafmb bvEfiP9g+3cilIxRn7OyK8uP0+OQfSnoWikHHlBCJb9AM9LKwajWQDTqZ2RnD+cRpQk+ 7QZARleTQczHJN2EwQ3SbT8GdE5+Z49wWHT93xIRUICVx2F+eYMy7ulcKJO4a3Tijk4m WTQMIyjfWhrM6xHvRLSSeUcLGU6K7HNRKY1ic1zs7ysA5B+Hm93Zr0/JQ2j+dy9/pjVH Rb3uirFeIVwwqV5+VkBcG87SzKQPpE09s22EsdDUzFUSfHFXeYZWvfeIJvOIdnGBF/yN v1dg== 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=DMZUsJNikyQLrk20aOH886hKhnIgPHP49kGmFXo+Dg0=; b=lYHQMOvypDtw7QnTYQXQMTKUluOmqpIKJyL+6Zu2czn67rK4djDRhcCQOdQcwAQPl8 HmbEywvvUA2SPEBviq3Pd99tGIih3qIq29eh5brpgu35/DyiyuVb//mLj+mpnQ49pimS Xc0ziXT7Ye/75MaPslV9/i3fWW4IiCYA83zzq1sQbfY6Qe9lX9BDfkQh1RwFeOK7AZpY CZh8uesGO5TGPIpzxl4GmjUDwQI2eTFfLOIluHk4tOzq4zX/auwgmPwiooo956ndjojx GtMW+BGB3COXLFoe+Z3QhChcePt+ETjTpr5rt6OwNiWaErUE3/+wKflCvPtwFQgI6GKn PRDA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r2-20020a50aac2000000b00461f2136969si5198428edc.242.2022.10.30.10.35.31; Sun, 30 Oct 2022 10:35:56 -0700 (PDT) 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 S229727AbiJ3ReQ (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229835AbiJ3Rdw (ORCPT ); Sun, 30 Oct 2022 13:33:52 -0400 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 EAC7CA44D for ; Sun, 30 Oct 2022 10:33:51 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBw-000469-MM; Sun, 30 Oct 2022 18:33:48 +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 Subject: [PATCH v2 10/13] staging: r8188eu: remove return value from on_action_public_vendor Date: Sun, 30 Oct 2022 18:33:23 +0100 Message-Id: <20221030173326.1588647-11-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134900228465573?= X-GMAIL-MSGID: =?utf-8?q?1748134900228465573?= The only caller of on_action_public_vendor does not check the return value. We can make it a void function. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index b3cef3504ad3..b395457a6a60 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3779,17 +3779,13 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) return _SUCCESS; } -static unsigned int on_action_public_vendor(struct recv_frame *precv_frame) +static void on_action_public_vendor(struct recv_frame *precv_frame) { - unsigned int ret = _FAIL; u8 *pframe = precv_frame->rx_data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); - if (!memcmp(frame_body + 2, P2P_OUI, 4)) { - ret = on_action_public_p2p(precv_frame); - } - - return ret; + if (!memcmp(frame_body + 2, P2P_OUI, 4)) + on_action_public_p2p(precv_frame); } static unsigned int on_action_public_default(struct recv_frame *precv_frame) From patchwork Sun Oct 30 17:33:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1894057wru; Sun, 30 Oct 2022 10:36:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XLZXezFcqTvv93GiWn/5fs6TkeO/zlekMiQ8TCwTekqPo7lZRE+vXoOhfBxWVbevCbPrq X-Received: by 2002:a05:6402:406:b0:458:a47:d14c with SMTP id q6-20020a056402040600b004580a47d14cmr9832516edv.41.1667151361973; Sun, 30 Oct 2022 10:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151361; cv=none; d=google.com; s=arc-20160816; b=N2Zb9PRzagQbj6nBzd3+WVG19vRWHWMc41Yep6QSdRzhv/DQyoEFAx4jOj0rFH6NGi c2lfAdqkD6kGvCOYTAdFltXJmOhEFzI8K1q8jEqxNI3fauQWTG8hzIq/ul+xFDj3woC7 qlN7tK4N8ECVqqKzMCLkd9iElGbqiXNjrshutYA7XrDY+RK9c+APzab9XZ0MyBfQagZ4 oZ8dqNPdJequ2TsJMNBJ8WqBD0SRfjjSMTXKjkG/r6wfgMENKcefiKysyQblbkLxLUM3 aHQxIU31Wcqjhg5BYbne3nA6J+aTyXakfIGRUleCk8jNQ1SwwDo1dxRyDgdbhYIf1F+i s8WQ== 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=yBnzgeOVv70gnxTpcK6WQn8BCY9lk3Ouvi6oxwV0GhY=; b=twyJIOfhphW5W8BntR5GHZmqCHFLnA1d/YwOW8eZs3mX7ZBVtePRP0UiUSpTihrW0m c/DhPmxzso4lbAY2oHRoGlJeW3Ym3Tla1eutBhBimVMq/l9gFYwn12qg4LRWfzsME38j 5y3haeZZFY/fKu5k3pH1JDOlEMlrKSt11JzzT7XU+Iko2XznfMvPi55nl8vzqN2H32tc iD4zM6i8iQ0fqt9cSuniIyPYlPR5TSiEqucm/DvRV32MSEgoq4uaITlR+z6BkrNfyxM3 08KRjSnEnV3+tDNg3IE4wJtyM3dYHi8UAbv2uq+o1I01vHfEl4Gqh8oWLEwqGSWtaFSy Nmjw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn1-20020a17090794c100b00791a3dd01b6si5812067ejc.864.2022.10.30.10.35.38; Sun, 30 Oct 2022 10:36:01 -0700 (PDT) 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 S229874AbiJ3ReW (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiJ3Rdx (ORCPT ); Sun, 30 Oct 2022 13:33:53 -0400 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 1F7BAA44F for ; Sun, 30 Oct 2022 10:33:52 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBx-000469-Ey; Sun, 30 Oct 2022 18:33:49 +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 Subject: [PATCH v2 11/13] staging: r8188eu: remove return value from on_action_public_default Date: Sun, 30 Oct 2022 18:33:24 +0100 Message-Id: <20221030173326.1588647-12-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134906333490019?= X-GMAIL-MSGID: =?utf-8?q?1748134906333490019?= The only caller of on_action_public_default does not check the return value. We can make it a void function. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index b395457a6a60..f5923792f067 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3788,22 +3788,15 @@ static void on_action_public_vendor(struct recv_frame *precv_frame) on_action_public_p2p(precv_frame); } -static unsigned int on_action_public_default(struct recv_frame *precv_frame) +static void on_action_public_default(struct recv_frame *precv_frame) { - unsigned int ret = _FAIL; u8 *pframe = precv_frame->rx_data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); u8 token; token = frame_body[2]; - if (rtw_action_public_decache(precv_frame, token) == _FAIL) - goto exit; - - ret = _SUCCESS; - -exit: - return ret; + rtw_action_public_decache(precv_frame, token); } static void on_action_public(struct adapter *padapter, struct recv_frame *precv_frame) From patchwork Sun Oct 30 17:33:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1894510wru; Sun, 30 Oct 2022 10:37:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MyQVbPZcvUzx/zjlM59lfTxIey3Wt5uW65xLCfbiAUc3L8clBFXaTyS5cZnqSTzvpM0PX X-Received: by 2002:a17:907:7d8b:b0:78e:2534:4fd3 with SMTP id oz11-20020a1709077d8b00b0078e25344fd3mr9327685ejc.141.1667151441408; Sun, 30 Oct 2022 10:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151441; cv=none; d=google.com; s=arc-20160816; b=P4vGpL6jheRaso+Wjqxq9UuK8ll2r3apG2s8xvutEwogYGMhDYOyyh7A/p4X+msURE Yw3Lbqtz/8jFSGsfT3U7AP279WbTMHFKVT67rCbqBCArp9cbHPzDaOYt5FagbWlwztMa 8xYsaRCJp8brTHNiHl04cN4/ne199PZo2zLpGlEfZIV74zbFmIn2Brr6w2mhLIjvcLkS FpU7PDY8HhHY9WVsEl52U4BJzMHX7tUyvJTzz7bvo/B/uP6zlx3qoX+4TWRnPlViJK46 fkiMRsD6D438TU4ND0i8DJMcqVx592W+GZg7rWBrswxoXiHqBohJSRIe43LopXCkVcnQ LMow== 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=N8k5BQiASjLfk9ZeQkhld1UxXUO9WHtld1W1SEJUdg8=; b=0inDNG5nBncGQoAmfMIPiBBSCMaxWsynIblZlZeZ5En+TFFtGaqjFXTzI7WDS0n6nP kgng+QwQ3sDk2OpthnEYn49p/byTzwK8BufrWVx9p734DJ2816NWDazq/BMzI+f0jCZE u0/iDZCqSpBoTJudhqK4r+DgvDcelPfp5vY399nX2tOY4oyznoV8dV0vj7aaOwVnH+u6 6Mi2Jvgbfw3EjVw/V6kh3IYhfrsQAGKwjTUvQXX4Jtw2YJQLLy5YrdwDvXauzp+yx82L 0rX9b+ccMRxebHqE/N8WOne6LDLXFrK3xBMl5xrnFIy3fx8mDNp/TU0im6oq8Yvoiypd pQoQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y19-20020a056402441300b00456d901922bsi4839770eda.510.2022.10.30.10.36.58; Sun, 30 Oct 2022 10:37:21 -0700 (PDT) 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 S230003AbiJ3Re2 (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbiJ3Rdy (ORCPT ); Sun, 30 Oct 2022 13:33:54 -0400 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 8D59895B4 for ; Sun, 30 Oct 2022 10:33:53 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBy-000469-8K; Sun, 30 Oct 2022 18:33:50 +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 Subject: [PATCH v2 12/13] staging: r8188eu: rtw_action_public_decache's token is a u8 Date: Sun, 30 Oct 2022 18:33:25 +0100 Message-Id: <20221030173326.1588647-13-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134989472255612?= X-GMAIL-MSGID: =?utf-8?q?1748134989472255612?= Both callers of rtw_action_public_decache pass a u8 value for the token parameter. We can change token from s32 to u8 and remove the code for token < 0. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index f5923792f067..93f3d387e92d 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3490,7 +3490,7 @@ inline void issue_probereq_p2p(struct adapter *adapter, u8 *da) _issue_probereq_p2p(adapter, da); } -static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token) +static s32 rtw_action_public_decache(struct recv_frame *recv_frame, u8 token) { struct adapter *adapter = recv_frame->adapter; struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv; @@ -3499,21 +3499,13 @@ static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token) (recv_frame->attrib.frag_num & 0xf); if (GetRetry(frame)) { - if (token >= 0) { - if ((seq_ctrl == mlmeext->action_public_rxseq) && - (token == mlmeext->action_public_dialog_token)) - return _FAIL; - } else { - if (seq_ctrl == mlmeext->action_public_rxseq) - return _FAIL; - } + if ((seq_ctrl == mlmeext->action_public_rxseq) && + (token == mlmeext->action_public_dialog_token)) + return _FAIL; } mlmeext->action_public_rxseq = seq_ctrl; - - if (token >= 0) - mlmeext->action_public_dialog_token = token; - + mlmeext->action_public_dialog_token = token; return _SUCCESS; } From patchwork Sun Oct 30 17:33:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1894160wru; Sun, 30 Oct 2022 10:36:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75/FyNFQT2GeJMef4MeSgLzo6AhbdSmwAn9xEIUD330kN0kBrlJDQA92eOKjaMHCHSwl5v X-Received: by 2002:a05:6402:1cc5:b0:453:ed3f:6a38 with SMTP id ds5-20020a0564021cc500b00453ed3f6a38mr9857175edb.346.1667151381351; Sun, 30 Oct 2022 10:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151381; cv=none; d=google.com; s=arc-20160816; b=TCRxhddGNqdgfz89hwDsPG21Vq/bRqvsF9caxm6AKVi6egCCLfQJku2lFQzpfYXsUf XpCGGpti2+nW/nLI//L+G7cJJ1MyK5oljXbpKm5FZCJz3fH0okpxWgjxT1ZNrF72W+6y cXxuqg7NMOsM6nXizmVFCktphscld++3SwaXZ8Nd/A84D25LHXZPDfLqJB9zpTgkl4SU Sq22fFFQeM14HPlqIJgnIXYHzgxT3rh9zfnIMCpoc4wbgFZKb4OmAg0KPYw9MUO0l1g6 DU0iqJPx9VVKBKkV1hs0p9QH5woTSLlmaxuYd7GcRjGj6Ma9oqJhxlWFAXG4fcN24Shw 8YBg== 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=XEEr+6ilrEHWzb8gusSS9Q9Fm4iEeIJnwWVdTU4i58Y=; b=lUXGDaV541MzmPYmEc7hgswwhW/wzZzWfBXmacE0S9+gdJ2in5hj9ZFBWO3SiR4G7P +S9YBbGHN2hWphEm101mvBUxtky00RPMJRWWYVZsKysVM20K1+B7W1jJ4VBpObb9Suax bKIOJ2mJpJcYUTO02XoM8xmgTqnpRIY4Xyh6biPyXv7NCz85CXFqGtdjP6iVee49M54D gAlWd0nQeIc6scBae+FXMKWsdYhzRLJbLzO9lOCOqqtCzwL9UBg+aATJzHAelk8ZMkLW ZvOYRSYCsE94YpNraVhyjCQo7u6mIr1qaY/kESr/OTvBAZX0FcupZc28jWM+eH8jET9l uDCA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a056402500b00b00459563e2c60si5461426eda.329.2022.10.30.10.35.57; Sun, 30 Oct 2022 10:36:21 -0700 (PDT) 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 S230010AbiJ3Rec (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbiJ3Rdy (ORCPT ); Sun, 30 Oct 2022 13:33:54 -0400 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 2BD9DA465 for ; Sun, 30 Oct 2022 10:33:54 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBz-000469-45; Sun, 30 Oct 2022 18:33:51 +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 Subject: [PATCH v2 13/13] staging: r8188eu: check destination address in OnAction Date: Sun, 30 Oct 2022 18:33:26 +0100 Message-Id: <20221030173326.1588647-14-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-1-martin@kaiser.cx> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748134926744792634?= X-GMAIL-MSGID: =?utf-8?q?1748134926744792634?= All subfunctions of OnAction check if the destination address matches the local interface's address. It's simpler to move this check to OnAction. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 93f3d387e92d..e985fc5fc575 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1492,9 +1492,6 @@ static void OnAction_back(struct adapter *padapter, struct recv_frame *precv_fra struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; u8 *pframe = precv_frame->rx_data; struct sta_priv *pstapriv = &padapter->stapriv; - /* check RA matches or not */ - if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))/* for if1, sta/ap mode */ - return; if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE) if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) @@ -3795,10 +3792,6 @@ static void on_action_public(struct adapter *padapter, struct recv_frame *precv_ { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; - /* check RA matches or not */ - if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) - return; - /* All members of the action enum start with action_code. */ if (mgmt->u.action.u.s1g.action_code == WLAN_PUB_ACTION_VENDOR_SPECIFIC) on_action_public_vendor(precv_frame); @@ -3808,17 +3801,12 @@ static void on_action_public(struct adapter *padapter, struct recv_frame *precv_ static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame) { - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; u8 *frame_body; u8 OUI_Subtype; u8 *pframe = precv_frame->rx_data; uint len = precv_frame->len; struct wifidirect_info *pwdinfo = &padapter->wdinfo; - /* check RA matches or not */ - if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))/* for if1, sta/ap mode */ - return; - frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); if (be32_to_cpu(*((__be32 *)(frame_body + 1))) != P2POUI) @@ -3835,6 +3823,9 @@ static void OnAction(struct adapter *padapter, struct recv_frame *precv_frame) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; + if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) + return; + switch (mgmt->u.action.category) { case WLAN_CATEGORY_BACK: OnAction_back(padapter, precv_frame);