From patchwork Mon Jul 10 13:10:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 107293 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3401382qge; Mon, 10 Jul 2017 06:11:24 -0700 (PDT) X-Received: by 10.98.59.1 with SMTP id i1mr44299823pfa.147.1499692284798; Mon, 10 Jul 2017 06:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499692284; cv=none; d=google.com; s=arc-20160816; b=foTdZx8pPNd0q6szzn0QnJfAljWZzGgzENMw9OaFydZcRgUmBLoLFUwfS5ZjfkC3ga oKhpTXJBnrujUyqB3qxr/S6raZ+Axl/ic0JU/taHovusmFk0HgdSQ/Xdiu0OcfJ/sMHe M9lRBncobajfjK5ga0faZo+NBhUBJ5pVrkIaCkL4c161dGjKa4p++0MmdEd3rcvEpWk+ 9mT6vMPoo7lN7mO8iWy+Zh6OYIfYpFQT2BTbBGs6dkUgoMMFDFUN8Z847xiw2Wo5x0Eb lQiAi5eEX+TNiigEaXJ2zOTloVO97HmFoyiIliI9WRzvwfofe+TBIya1HOzXBbWU8FtS uagw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=aO3GLBKfg+DbyvVtMyQF9tXqsSAFvl9b0J2z5v+jUHs=; b=oi5+tK68lwNj0r8rhZCTPfeWdA036TX/9TGVH1mRn8vOfUE3s8ab9puRpkBafMOgaN 9+oObX5F2+7e2kUQdBKTTo9sRULWR87ewUXRy+LqS7n0IN3GlmUfW7ubXE2EJPGGZyqc m5cwZWZS+hp1iBsklksudarJZZdE+LFyCu2kEchx9c/vZuFUdECAWaLmt5sOox0YqTxK mctvXZhxPheuLZDg9p2bxhAWiRc4LZMpbGN8Q4p/zVSrwCdxN9bNRX8duAjpM7k/oJEu +Hel5WeYkhyB9XmsZapeyddKiVO8789Zzsbnb9C5d/8PjlH259zTTNZGq+Pnqkd3dYtG vmGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u71si8120790pgd.469.2017.07.10.06.11.24; Mon, 10 Jul 2017 06:11:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754041AbdGJNLG (ORCPT + 25 others); Mon, 10 Jul 2017 09:11:06 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:64162 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753538AbdGJNLF (ORCPT ); Mon, 10 Jul 2017 09:11:05 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0Mgegh-1dHXkI2USd-00Nz9w; Mon, 10 Jul 2017 15:10:45 +0200 From: Arnd Bergmann To: Greg Kroah-Hartman Cc: Arnd Bergmann , "David S. Miller" , simran singhal , Jay Vosburgh , Georgiana Rodica Chelu , Bhumika Goyal , Tobias Klauser , Sebastian Haas , Jakub Jedelsky , Johannes Berg , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: rtl8192u: reduce stack frame size in ieee80211_rx_mgt_rsl Date: Mon, 10 Jul 2017 15:10:17 +0200 Message-Id: <20170710131036.1877067-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:u4rxFmNmFlBvNRl7DhTwYShT7sidvyVolTY8Zi+AL5AxmCxA/Tc +UNQgnVwVN7uKg4Zu1qHPEF2wGMzXTzDYxT8RErZCZP2zvv6seHSuJSVFaOrVwUbjGGHfNm dSS1DMOssxBMheNgpwlRW+3nozEwjC/S0zIae5iixrXdLe0VpLviD22sjBx4bnNaEXezDdR fiNj0CLuVYK5J6Ctt1Ydg== X-UI-Out-Filterresults: notjunk:1; V01:K0:lPxmmVWGzzU=:ppx1omKzsbXS1CWXFwCgMh dFwyyQPCeXy3q5sYtLO3W2vdkTGnmtSI1RkburzTCS72u/19zQpIuZCCCW6l/JoqKzSJqtO/M 7IyOseSw0a0/05hcoHfa+4mfqsW6cLc+23hnFxpW0vHwHMk+Mt+RMMlEokVsPDNuSvfaIbvOy XtX2SNNsX35EvblcYBEIsCxwP+EUcuHC9N+Xi+iJrSnPAxz9gzG/YzikUQzAyAGFx9T1jIDoD 1XblAtzWnvOgRzVW9cnzJXnI2av2r4nMjit4l4Bwnu9Myho8ljGNBlFFN/F2G1VY7XtuQpQqw jNOxA+jvy1H8oXzDCHseLnZYj+EUyRWw5coKcmi4/vLdE721NOzX3qLhZJhXbNEod3OVYMCz5 THg15PxUkXnmMcBfCxo/dAUcfPWREXHf7NiE1FFD0S3LqwwCt+THRTnhcfSCKL9uSRJbCTeKR YXTOwYi1rVO1j/Z3BHlA+iAetiQ2RcQRyABpYD9afDxx1qg8J+mmufbR/Sd3nYSbJsW/APh16 cOar5UH1ZxgksVvb68rnmeXfBXQhyWlXKXqJB3smGzcQceWH2GGkrtN46HyNFXTjGVZzbdpxP e/fcJt+yLWCZseiisHT+fTTBKAqtUFGPeSuoXpw0wI35NDSdi6O7m1/Q0BiMQ+ulKlbUTlQkX 0QaEjudWFcLi8mHOwVQl1Fl8wa0UQBx5Y9i1gS3FCp4GHFvKU83vbw5oKJenGVZsmgjE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I ran into a stack frame size warning in code that hasn't changed much recently, no idea why I didn't spot this earlier despite build many thousand randconfigs. drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function 'ieee80211_rx_mgt_rsl': drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:2563:1: error: the frame size of 1676 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] We have a couple of other copies of the same function in the kernel, and they simply don't put a gigantic structure on the stack, so I'm changing this copy to do the same as the others, replacing the stack variable with a GFP_ATOMIC allocation. Signed-off-by: Arnd Bergmann --- This one is not important, as it only seems to show up in rare configurations. I'd suggest adding it to staging-next for 4.14 after the merge window. --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 62 +++++++++++------------ 1 file changed, 31 insertions(+), 31 deletions(-) -- 2.9.0 diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 780059c3eb60..59274d6c982f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -2324,12 +2324,12 @@ static inline int is_beacon(__le16 fc) return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON); } -static inline void ieee80211_process_probe_response( +static void ieee80211_process_probe_response( struct ieee80211_device *ieee, struct ieee80211_probe_response *beacon, struct ieee80211_rx_stats *stats) { - struct ieee80211_network network; + struct ieee80211_network *network; struct ieee80211_network *target; struct ieee80211_network *oldest = NULL; #ifdef CONFIG_IEEE80211_DEBUG @@ -2341,7 +2341,7 @@ static inline void ieee80211_process_probe_response( u16 capability; //u8 wmm_info; - memset(&network, 0, sizeof(struct ieee80211_network)); + network = kzalloc(sizeof(*network), GFP_ATOMIC); capability = le16_to_cpu(beacon->capability); IEEE80211_DEBUG_SCAN( "'%s' (%pM): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", @@ -2364,7 +2364,7 @@ static inline void ieee80211_process_probe_response( (capability & (1 << 0x1)) ? '1' : '0', (capability & (1 << 0x0)) ? '1' : '0'); - if (ieee80211_network_init(ieee, beacon, &network, stats)) { + if (ieee80211_network_init(ieee, beacon, network, stats)) { IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", escape_essid(info_element->data, info_element->len), @@ -2381,7 +2381,7 @@ static inline void ieee80211_process_probe_response( // then wireless adapter should do active scan from ch1~11 and // passive scan from ch12~14 - if (!IsLegalChannel(ieee, network.channel)) + if (!IsLegalChannel(ieee, network->channel)) return; if (ieee->bGlobalDomain) { @@ -2390,8 +2390,8 @@ static inline void ieee80211_process_probe_response( // Case 1: Country code if(IS_COUNTRY_IE_VALID(ieee) ) { - if (!IsLegalChannel(ieee, network.channel)) { - printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network.channel); + if (!IsLegalChannel(ieee, network->channel)) { + printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network->channel); return; } } @@ -2399,9 +2399,9 @@ static inline void ieee80211_process_probe_response( else { // Filter over channel ch12~14 - if (network.channel > 11) + if (network->channel > 11) { - printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); + printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network->channel); return; } } @@ -2411,8 +2411,8 @@ static inline void ieee80211_process_probe_response( // Case 1: Country code if(IS_COUNTRY_IE_VALID(ieee) ) { - if (!IsLegalChannel(ieee, network.channel)) { - printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n",network.channel); + if (!IsLegalChannel(ieee, network->channel)) { + printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n",network->channel); return; } } @@ -2420,9 +2420,9 @@ static inline void ieee80211_process_probe_response( else { // Filter over channel ch12~14 - if (network.channel > 14) + if (network->channel > 14) { - printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",network.channel); + printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",network->channel); return; } } @@ -2441,8 +2441,8 @@ static inline void ieee80211_process_probe_response( spin_lock_irqsave(&ieee->lock, flags); - if (is_same_network(&ieee->current_network, &network, ieee)) { - update_network(&ieee->current_network, &network); + if (is_same_network(&ieee->current_network, network, ieee)) { + update_network(&ieee->current_network, network); if ((ieee->current_network.mode == IEEE_N_24G || ieee->current_network.mode == IEEE_G) && ieee->current_network.berp_info_valid){ if(ieee->current_network.erp_value& ERP_UseProtection) @@ -2456,11 +2456,11 @@ static inline void ieee80211_process_probe_response( ieee->LinkDetectInfo.NumRecvBcnInPeriod++; } else //hidden AP - network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags); + network->flags = (~NETWORK_EMPTY_ESSID & network->flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags); } list_for_each_entry(target, &ieee->network_list, list) { - if (is_same_network(target, &network, ieee)) + if (is_same_network(target, network, ieee)) break; if ((oldest == NULL) || (target->last_scanned < oldest->last_scanned)) @@ -2489,16 +2489,16 @@ static inline void ieee80211_process_probe_response( #ifdef CONFIG_IEEE80211_DEBUG IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n", - escape_essid(network.ssid, - network.ssid_len), - network.bssid, + escape_essid(network->ssid, + network->ssid_len), + network->bssid, fc == IEEE80211_STYPE_PROBE_RESP ? "PROBE RESPONSE" : "BEACON"); #endif - memcpy(target, &network, sizeof(*target)); + memcpy(target, network, sizeof(*target)); list_add_tail(&target->list, &ieee->network_list); if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) - ieee80211_softmac_new_net(ieee,&network); + ieee80211_softmac_new_net(ieee,network); } else { IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n", escape_essid(target->ssid, @@ -2514,22 +2514,22 @@ static inline void ieee80211_process_probe_response( renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); //YJ,add,080819,for hidden ap if(is_beacon(beacon->header.frame_ctl) == 0) - network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags); - //if(strncmp(network.ssid, "linksys-c",9) == 0) - // printk("====>2 network.ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network.ssid, network.flags, target->ssid, target->flags); - if(((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ - && (((network.ssid_len > 0) && (strncmp(target->ssid, network.ssid, network.ssid_len)))\ - ||((ieee->current_network.ssid_len == network.ssid_len)&&(strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0)&&(ieee->state == IEEE80211_NOLINK)))) + network->flags = (~NETWORK_EMPTY_ESSID & network->flags)|(NETWORK_EMPTY_ESSID & target->flags); + //if(strncmp(network->ssid, "linksys-c",9) == 0) + // printk("====>2 network->ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network->ssid, network->flags, target->ssid, target->flags); + if(((network->flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ + && (((network->ssid_len > 0) && (strncmp(target->ssid, network->ssid, network->ssid_len)))\ + ||((ieee->current_network.ssid_len == network->ssid_len)&&(strncmp(ieee->current_network.ssid, network->ssid, network->ssid_len) == 0)&&(ieee->state == IEEE80211_NOLINK)))) renew = 1; //YJ,add,080819,for hidden ap,end - update_network(target, &network); + update_network(target, network); if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)) - ieee80211_softmac_new_net(ieee,&network); + ieee80211_softmac_new_net(ieee,network); } spin_unlock_irqrestore(&ieee->lock, flags); - if (is_beacon(beacon->header.frame_ctl)&&is_same_network(&ieee->current_network, &network, ieee)&&\ + if (is_beacon(beacon->header.frame_ctl)&&is_same_network(&ieee->current_network, network, ieee)&&\ (ieee->state == IEEE80211_LINKED)) { if (ieee->handle_beacon != NULL) { ieee->handle_beacon(ieee->dev,beacon,&ieee->current_network);