Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1024631ybe; Thu, 19 Sep 2019 07:32:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGXGXI8AkoIaxkLW7/eqKNEHq9KPqhNGp749lCwUWh9Grcxm4moyye443AS2DzN+PUnT9A X-Received: by 2002:a50:eb4c:: with SMTP id z12mr16545726edp.155.1568903576800; Thu, 19 Sep 2019 07:32:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568903576; cv=none; d=google.com; s=arc-20160816; b=RRsnMrXUz5bMlKqb14sr/ACYFl5UnSlTRBczbYlYPn/bhRIHzy6oi198dSEoFyYvxg 2FDQtOSHiMQV0cQ9haDv1E5zc/vHNXaDTwZ+wuZmQLJPhMBT3c11srdn3rYuRDQB5FGo i+BDznHZmOnM6FVMIlDeyYJyoRpViIU9FC05cZEnZCG9gN9SDJsnmYC2icwZbnxVnM7i eNJIlXfI2hwgdwwrfM693YGyB87ffx5pX+RM2okxm6ZegD0hc+A2jnlc8JbNGDW+b0m9 9YFdKqzI2Lo3yZIP3t+lGmsc3Tcll6BQ/KgC07dzy1mlMt0sACQx4ZrEY1F05MPy5nUg fA5A== 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 :message-id:date:subject:cc:to:from; bh=Hdk+Cg16gDGGnI6FwIP+8FpgLlqvIFEL5PjFGquITMU=; b=i2gvHTN/lWtQvmdiqH9wgbhPL6jN1u2VRUhlaXHNTgpLt1BEeuxqPhmH6cdjadwqRD 9OQGmO8P4Q5ylb9xIZUWOC/o9PAI7ywVR5pg9iETjiZHX/cJGHhlSWbMm0IrMQX3F79b t7sglWUXKMZYZDFGvZxMAYPtP1bZmGvL0YPwD/D2VESZWiNeIe1VUkodh35g8sAA1OWN pmy9U3NOFcjraAqeHJhNM+7KCjJablMZQKgRo9pC8qP7xgAjVqaw+ZI7m4HRnKhgAcCH /VuppHTBqfHqAsnuY0EuACxX8WxxZ2ijqLF7ECaDAhL9Qj/Y/AXGiZCAx9380SBqplqx rdqg== 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 u10si1468091ejx.163.2019.09.19.07.32.33; Thu, 19 Sep 2019 07:32:56 -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 S2389274AbfISMej (ORCPT + 99 others); Thu, 19 Sep 2019 08:34:39 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:43361 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731958AbfISMej (ORCPT ); Thu, 19 Sep 2019 08:34:39 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1McGp2-1hfAig3hzo-00cgzT; Thu, 19 Sep 2019 14:34:22 +0200 From: Arnd Bergmann To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Maxime Coquelin Cc: Arnd Bergmann , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] net: stmmac: selftest: avoid large stack usage Date: Thu, 19 Sep 2019 14:33:43 +0200 Message-Id: <20190919123416.3070938-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-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R0ENSBm/Pw2giP403UP24zgk/dKjySnNFfdTGLo1N0BC/SW+X SHEYUb0Z3o8ClxL2/kVgCjuR/FpIfWYYyDK2GE8FY+YzDtFKEJ0aoepc1P9WdUxgpckXfhMub y/Jc3/qeFX+KcCNMNKSQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Putting a struct stmmac_rss object on the stack is a bad idea, as it exceeds the warning limit for a stack frame on 32-bit architectures: drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1221:12: error: stack frame size of 1208 bytes in function '__stmmac_test_l3filt' [-Werror,-Wframe-larger-than=] drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1338:12: error: stack frame size of 1208 bytes in function '__stmmac_test_l4filt' [-Werror,-Wframe-larger-than=] As the object is the trivial empty case, change the called function to accept a NULL pointer to mean the same thing and remove the large variable in the two callers. Fixes: 4647e021193d ("net: stmmac: selftests: Add selftest for L3/L4 Filters") Signed-off-by: Arnd Bergmann --- v2: simply configure function, based on feedback from Jose --- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 5 ++--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 14 ++++---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index d5173dd02a71..2b277b2c586b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -523,19 +523,18 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, struct stmmac_rss *cfg, u32 num_rxq) { void __iomem *ioaddr = hw->pcsr; - u32 *key = (u32 *)cfg->key; int i, ret; u32 value; value = readl(ioaddr + XGMAC_RSS_CTRL); - if (!cfg->enable) { + if (!cfg || !cfg->enable) { value &= ~XGMAC_RSSE; writel(value, ioaddr + XGMAC_RSS_CTRL); return 0; } for (i = 0; i < (sizeof(cfg->key) / sizeof(u32)); i++) { - ret = dwxgmac2_rss_write_reg(ioaddr, true, i, *key++); + ret = dwxgmac2_rss_write_reg(ioaddr, true, i, cfg->key[i]); if (ret) return ret; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c index c56e89e1ae56..9c8d210b2d6a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -1233,12 +1233,9 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src, return -EOPNOTSUPP; if (!priv->dma_cap.l3l4fnum) return -EOPNOTSUPP; - if (priv->rss.enable) { - struct stmmac_rss rss = { .enable = false, }; - - stmmac_rss_configure(priv, priv->hw, &rss, + if (priv->rss.enable) + stmmac_rss_configure(priv, priv->hw, NULL, priv->plat->rx_queues_to_use); - } dissector = kzalloc(sizeof(*dissector), GFP_KERNEL); if (!dissector) { @@ -1357,12 +1354,9 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src, return -EOPNOTSUPP; if (!priv->dma_cap.l3l4fnum) return -EOPNOTSUPP; - if (priv->rss.enable) { - struct stmmac_rss rss = { .enable = false, }; - - stmmac_rss_configure(priv, priv->hw, &rss, + if (priv->rss.enable) + stmmac_rss_configure(priv, priv->hw, NULL, priv->plat->rx_queues_to_use); - } dissector = kzalloc(sizeof(*dissector), GFP_KERNEL); if (!dissector) { -- 2.20.0