Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1617903ybv; Fri, 21 Feb 2020 00:23:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzM2+l8+dNaUZ5ayAdgmX47fOv/ngzCjwixcVa0A8Xp+H7oK5mHvKgu6YxCazQyoRje+Ley X-Received: by 2002:aca:510a:: with SMTP id f10mr1044560oib.100.1582273384027; Fri, 21 Feb 2020 00:23:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273384; cv=none; d=google.com; s=arc-20160816; b=XAkz5oojjICsmBtq/56tIihxqI+6ggmRsg74y2/ie8NePKQAA3fVvaYHRYz7i3/cEF 5TeIKEQwjv2VzX5+hkJhS9kjHpsBrbgpmh0qHvQVaJlNBzPV8KAQJVxOei/UTeCab5MS /l5VQuKahxznNVau5BRdfaMiuv4ADotg/0lIl+bQpBaOJNcdJz/RiBYK+KdeGkh64fTk xq+w1M+AwAdlGqTQWO9Y0azPy5j0YPhLR9i+UrM2m22T/B1UDxhb6GjNXXNimHlZGkaY VEAlH/4UnOo1XEpMtnNKxumxyeyZemEt8VkR+s2vgEG618KxSyB7m68gSe/vdu7Hk1+B Nd1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oilZvy6P/3sQiEzwCjWt9PD1rfCxF3R7jTTeFSWsfZM=; b=eRgewUSSl+FO2FzwIuuyFfKu4ykIcD4wiXp/XQ2Zl4bgQ3skgStMmWtkP6GxA3YkA8 KjuluXGJ/5tuPl/ts4FfC4EQS8Qsv4guCvyU6TqhUIEGHolZTC08WjzCqDkVQ42vW7kd aEZ/Ifdn+t52RhnYjD1+ytcuGXQi8EUhMemcM2ezXulqbi/rgC9gZ7PTm2x9c0+fs5iC YFxzBXlcJAMyRquBhjQIX+4SKE/2QjTsQi3Y94tWIu+XJ0MhDcbGSEXS//Wx8jwbIZ/H nuAgZqSiYT+AtGVMZGRiKwLCWXdK78a3/kMYYfA0tkTUpk0D7+2vlaY9PeMyKBN9fvn2 0mLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="S4yC/l54"; 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 k19si1123798otr.52.2020.02.21.00.22.52; Fri, 21 Feb 2020 00:23:04 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="S4yC/l54"; 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 S2388233AbgBUIVK (ORCPT + 99 others); Fri, 21 Feb 2020 03:21:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:60394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387997AbgBUIVE (ORCPT ); Fri, 21 Feb 2020 03:21:04 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DCA19206ED; Fri, 21 Feb 2020 08:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273264; bh=sVnxuLXbC0/c7u22TqpsUNlP8xJHaNjnGHR1lfIr40U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S4yC/l54ZA0PQDvLy+UDKu7P6cgFID8QIcdrlJe2uOV8TDpZkShM9gXsd/fujuMOr fVAUkqSo1+Aq359E89Sjze2TDDOxClMLlhxoKfTwNG7u6Zz+XikJG2lc7tO2hMtjs3 FtHYUDfWPaR3QFXeFx/4NNT2FnyqoDMg4WOySGAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Sasha Levin Subject: [PATCH 4.19 106/191] staging: rtl8188: avoid excessive stack usage Date: Fri, 21 Feb 2020 08:41:19 +0100 Message-Id: <20200221072303.661252801@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit c497ae2077c055b85c1bf04f3d182a84bd8f365b ] The rtl8188 copy of the os_dep support code causes a warning about a very significant stack usage in the translate_scan() function: drivers/staging/rtl8188eu/os_dep/ioctl_linux.c: In function 'translate_scan': drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:306:1: error: the frame size of 1560 bytes is larger than 1400 bytes [-Werror=frame-larger-than=] Use the same trick as in the rtl8723bs copy of the same function, and allocate it dynamically. Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20200104214832.558198-1-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index bee3c3a7a7a99..2db4444267a74 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -229,18 +229,21 @@ static char *translate_scan(struct adapter *padapter, /* parsing WPA/WPA2 IE */ { - u8 buf[MAX_WPA_IE_LEN]; + u8 *buf; u8 wpa_ie[255], rsn_ie[255]; u16 wpa_len = 0, rsn_len = 0; u8 *p; + buf = kzalloc(MAX_WPA_IE_LEN, GFP_ATOMIC); + if (!buf) + return start; + rtw_get_sec_ie(pnetwork->network.ies, pnetwork->network.ie_length, rsn_ie, &rsn_len, wpa_ie, &wpa_len); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_wx_get_scan: ssid =%s\n", pnetwork->network.Ssid.Ssid)); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_wx_get_scan: wpa_len =%d rsn_len =%d\n", wpa_len, rsn_len)); if (wpa_len > 0) { p = buf; - memset(buf, 0, MAX_WPA_IE_LEN); p += sprintf(p, "wpa_ie="); for (i = 0; i < wpa_len; i++) p += sprintf(p, "%02x", wpa_ie[i]); @@ -257,7 +260,6 @@ static char *translate_scan(struct adapter *padapter, } if (rsn_len > 0) { p = buf; - memset(buf, 0, MAX_WPA_IE_LEN); p += sprintf(p, "rsn_ie="); for (i = 0; i < rsn_len; i++) p += sprintf(p, "%02x", rsn_ie[i]); @@ -271,6 +273,7 @@ static char *translate_scan(struct adapter *padapter, iwe.u.data.length = rsn_len; start = iwe_stream_add_point(info, start, stop, &iwe, rsn_ie); } + kfree(buf); } {/* parsing WPS IE */ -- 2.20.1