Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1729298ybe; Sat, 7 Sep 2019 01:35:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHDXUcf4P8OoR8kTYA8ySjnZjDG1NBbC5bkaDmSo6S95JcgN/6Zgrd2X2maRMPOnpqaynq X-Received: by 2002:a17:902:33a5:: with SMTP id b34mr13342682plc.286.1567845359135; Sat, 07 Sep 2019 01:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567845359; cv=none; d=google.com; s=arc-20160816; b=0R+1858PUz9UqJLzqAK/J5hVnQ0ikJ+sinvaHTLBx860cTslr3B6ClJY2XUAf8FdW9 sH/izC8B02rHe/COErC7FVwoyea+O6EHr0Yw0XtptCFauFXgq/mzT5SJou+iw9YidnZY yEXy0kIDqJYs1pQ0kYeYdK1UG2fpJGBCrR7ysY2xiKYdAahyg2oCx46qYx3TZOZCyCtf hNy5TXy2doOYMFikpsMKIg+8ihzbK5PM9/eXcGr1zdUKTemhoZJOs5hxVfEePutPx3TC 01BxVJoIxloGSplAHlsgHOUaIRFGst3Q6vMKBTOI1KEfp1XVwH4SBgePaNVsZK56ukDL DBNQ== 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=YphVu1HRDrft24d+JByIZUX+N9nBOZC8DjIcSsBUgcU=; b=FP70xViajszvFqtDYPis+c9qD7wZF99ffL0MsdK6cw/jAs+MXRQqthnQYKoDzNZrb+ NLXnFAaC2PVO2uh+fgRyw4TavnjgVnln+Qb12ZJXUUMwBpoAJpuF7S+JpaoiCn/Nz24O 8QsjeoumgfegXJ3epz4cZ1UDvkn2v55DGxiYcqSbKX7LxEl9nstmg8opXsG5iHAeQLJ7 N2r721CEhYReo9z56LP1QAiIDSBWUrXz9KBkTlLdgaNvJ49cMYVKhweg3og5OWPqJBcT DOekv4u9mpSLurcI5od0H5WOa0RDo872GysazkXGO1PSgkfXMacD6BaElkwgtOCIuQSO +IvA== 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 i8si8049872pfa.192.2019.09.07.01.35.28; Sat, 07 Sep 2019 01:35:59 -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 S2394915AbfIFP5x (ORCPT + 99 others); Fri, 6 Sep 2019 11:57:53 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:47473 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728741AbfIFP5w (ORCPT ); Fri, 6 Sep 2019 11:57:52 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mq1GE-1iRdCD3TDm-00nCjn; Fri, 06 Sep 2019 17:57:31 +0200 From: Arnd Bergmann To: Christian Benvenuti , Nelson Escobar , Parvi Kaustubhi , Doug Ledford , Jason Gunthorpe Cc: Arnd Bergmann , Leon Romanovsky , Gal Pressman , Parav Pandit , Davidlohr Bueso , Kamal Heib , Florian Westphal , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usnic: avoid overly large buffers on stack Date: Fri, 6 Sep 2019 17:57:17 +0200 Message-Id: <20190906155730.2750200-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-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b6lvIDIh22en6QGicoqKHIKtGJ6R32ZL4JOiQC1edNg44XI pmq2PPgWcFWLTZtn8YcmVlVLGDbyA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's never a good idea to put a 1000-byte buffer on the kernel stack. The compiler warns about this instance when usnic_ib_log_vf() gets inlined into usnic_ib_pci_probe(): drivers/infiniband/hw/usnic/usnic_ib_main.c:543:12: error: stack frame size of 1044 bytes in function 'usnic_ib_pci_probe' [-Werror,-Wframe-larger-than=] As this is only called for debugging purposes in the setup path, it's trivial to convert to a dynamic allocation. Signed-off-by: Arnd Bergmann --- drivers/infiniband/hw/usnic/usnic_ib_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c index 03f54eb9404b..c9abe1c01e4e 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c @@ -89,9 +89,15 @@ static void usnic_ib_dump_vf(struct usnic_ib_vf *vf, char *buf, int buf_sz) void usnic_ib_log_vf(struct usnic_ib_vf *vf) { - char buf[1000]; - usnic_ib_dump_vf(vf, buf, sizeof(buf)); + char *buf = kzalloc(1000, GFP_KERNEL); + + if (!buf) + return; + + usnic_ib_dump_vf(vf, buf, 1000); usnic_dbg("%s\n", buf); + + kfree(buf); } /* Start of netdev section */ -- 2.20.0