From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934417AbdKGBCX (ORCPT ); Mon, 6 Nov 2017 20:02:23 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52641 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755270AbdKFXyJ (ORCPT ); Mon, 6 Nov 2017 18:54:09 -0500 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Konrad Zapalowicz" , "Arnd Bergmann" , "Greg Kroah-Hartman" Date: Mon, 06 Nov 2017 23:03:02 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 268/294] staging: dgnc: Fix frame size is larger than 1024B In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.50-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Konrad Zapalowicz commit ea6e9dea2e72a7abd146a2c5bab726b27f34b36c upstream. This comit fixes the following sparse warnign: drivers/staging/dgnc/dgnc_tty.c:572:1: warning: the frame size of 1060 bytes is larger than 1024 bytes [-Wframe-larger-than=] This was caused by having buffer as an automatic variable. This commit moves it from the stack to the heap. Signed-off-by: Konrad Zapalowicz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Arnd Bergmann Signed-off-by: Ben Hutchings --- drivers/staging/dgnc/dgnc_tty.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -481,13 +481,18 @@ void dgnc_sniff_nowait_nolock(struct cha int nbuf; int i; int tmpbuflen; - char tmpbuf[TMPBUFLEN]; - char *p = tmpbuf; + char *tmpbuf; + char *p; int too_much_data; + tmpbuf = kzalloc(TMPBUFLEN, GFP_KERNEL); + if (!tmpbuf) + return; + p = tmpbuf; + /* Leave if sniff not open */ if (!(ch->ch_sniff_flags & SNIFF_OPEN)) - return; + goto exit; do_gettimeofday(&tv); @@ -534,7 +539,7 @@ void dgnc_sniff_nowait_nolock(struct cha * function was probably called by the interrupt/timer routines! */ if (n == 0) - return; + goto exit; /* * Copy as much data as will fit. @@ -579,6 +584,9 @@ void dgnc_sniff_nowait_nolock(struct cha } } while (too_much_data); + +exit: + kfree(tmpbuf); }