Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp508477imw; Wed, 13 Jul 2022 02:48:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vxT+HkBb/Kb4/Y0+1jD3IFoC2GKUCSGr2EXwGk0XdI3TDffhXbfu6dVXncyY0zWeLBRwd2 X-Received: by 2002:a05:6a00:114c:b0:528:2c7a:630e with SMTP id b12-20020a056a00114c00b005282c7a630emr2457281pfm.86.1657705714780; Wed, 13 Jul 2022 02:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657705714; cv=none; d=google.com; s=arc-20160816; b=qBwn8Xvp3ThDzbAInQ9cWp27KsFAEyMY4MT2+WJAFYjSLOPUIzzNF/rJiZ0Pbt1m7+ 1LgUzCMqXZYAv9gp/MCXqUSvgxPv/nMBZ4/rwVKHSWwrkS23SSbh9D7W4XfwHIT6qPnw Au62SWtNCykwLh9wTDC3tedqJksxBaZAjWwPKMo/lCpI/FHbQV7GPr5iAaFbF+V1QnnA SSx87pKjnWLvbdRCPrG8to93ouAHOzGyCiHh2tORXw7JoOCNZ15Dv5qBibNty4HNFK+V aN1llGeNfN8E/BFjdVakAkIP/BJGMi902lK2PMU/c6ebalpmNxgmhY2Szjlnz46EP4Cz pRew== 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 :dkim-signature; bh=fQhhEjKraYyQiBmUehadiMQLkQvP6p1VhWtxcoifpHg=; b=lInGmhxzNN16P6ywPWmLV0m5V/yREyXitHHTC0h7Vg1bwUg/cUWDSVKzLnh6zKIV2l dJRDN3pJmu3HlocPX1yK/sCs5dk3NvvPBR9s4+3Y5PQ3miHNoMuFZ11rU2EsMHtUPIcp 3xO2J527BLr54hzPPeHIC/AQtQhqCm5jdmvnnMVFlL4/iH4I5bWguVbZD1RrdpLc/qcs Yv6Wx3XQJz9ygwHDGEsXLUpgjAyJZrjsn3m98gOJHeBoZfZIEAcgfnboBzUmyZGAqS6F fN9iVVUtXyi6jdGvJVVp8TtoSf/SJYSGrbSNOKcQydcmw02wYzVD7CirkcDih7xHJJco 5uAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=vDGrWwLR; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj5-20020a170903048500b0016a5384072asi16109811plb.138.2022.07.13.02.48.26; Wed, 13 Jul 2022 02:48:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=vDGrWwLR; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235446AbiGMJqK (ORCPT + 65 others); Wed, 13 Jul 2022 05:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235620AbiGMJp2 (ORCPT ); Wed, 13 Jul 2022 05:45:28 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1A7FF6B82 for ; Wed, 13 Jul 2022 02:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=fQhhEjKraYyQiBmUehadiMQLkQvP6p1VhWtxcoifpHg=; t=1657705522; x=1658915122; b=vDGrWwLRsYonx8E3a9pOiqxZD9LDGUYAJlI1UCNxnLxQQya aAWXPWVsUxhiY/UYcTSRjuEJ1/fM9A0uXh4MrPS7s5ka1CFpbOSSaPg23S7gVZ8dwHwhu/dLeeVJM f6AciIPtNyItoaru+h/n8ul6ghfAZe0eTcl0xB/0pHkua4TFmzungtMl+z9pt2n7mGAxU7WIGzIF0 B0tZKJlReXm4KVnjHaNgihRgPNohMwsHKdS7GIzFZJFioQ1QVfg7SVYS430pdEKrQKM/VgcRqKWW+ AqsRqVveZMRy1p2vPV1zqWRkGIGVbM7jzvWfdWaeyiq/mQC45snYAdZ2FSCZeIcA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1oBYvo-00EgvB-E2; Wed, 13 Jul 2022 11:45:20 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 46/76] wifi: mac80211: don't re-parse elems in ieee80211_assoc_success() Date: Wed, 13 Jul 2022 11:44:32 +0200 Message-Id: <20220713114425.67c47f031e80.Ib37e7c341c74a7de1166bac5b936231fb549046e@changeid> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220713094502.163926-1-johannes@sipsolutions.net> References: <20220713094502.163926-1-johannes@sipsolutions.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-wireless@vger.kernel.org From: Johannes Berg We're already passing the elems pointer, and have parsed them from the same frame with exactly the same parameters, so don't need to do that again. Signed-off-by: Johannes Berg --- net/mac80211/mlme.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 1819a8161e12..aec77e81df99 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3469,27 +3469,17 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, bool is_s1g = cbss->channel->band == NL80211_BAND_S1GHZ; struct ieee80211_link_data *link = &sdata->deflink; u32 changed = 0; - u8 *pos; int err; bool ret; - /* AssocResp and ReassocResp have identical structure */ - - pos = mgmt->u.assoc_resp.variable; - aid = le16_to_cpu(mgmt->u.assoc_resp.aid); - if (is_s1g) { - pos = (u8 *) mgmt->u.s1g_assoc_resp.variable; - aid = 0; /* TODO */ - } capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); - elems = ieee802_11_parse_elems(pos, len - (pos - (u8 *)mgmt), false, - mgmt->bssid, assoc_data->bss->bssid); - - if (!elems) - return false; if (elems->aid_resp) aid = le16_to_cpu(elems->aid_resp->aid); + else if (is_s1g) + aid = 0; /* TODO */ + else + aid = le16_to_cpu(mgmt->u.assoc_resp.aid); /* * The 5 MSB of the AID field are reserved @@ -3864,7 +3854,6 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, ret = true; out: - kfree(elems); kfree(bss_ies); return ret; } -- 2.36.1