From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752456AbdLKTed (ORCPT ); Mon, 11 Dec 2017 14:34:33 -0500 Received: from smtprelay0077.hostedemail.com ([216.40.44.77]:44852 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751307AbdLKTec (ORCPT ); Mon, 11 Dec 2017 14:34:32 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:421:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:4321:5007:7903:8603:10004:10400:10848:11026:11232:11473:11658:11914:12043:12296:12740:12760:12895:13069:13095:13311:13357:13439:14659:14721:21080:21433:21434:21451:21627:30012:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: horn83_7e98662af9862 X-Filterd-Recvd-Size: 2486 Message-ID: <1513020868.3036.0.camel@perches.com> Subject: Re: [PATCH] tuners: tda8290: reduce stack usage with kasan From: Joe Perches To: Arnd Bergmann , Michael Krufky , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 11 Dec 2017 11:34:28 -0800 In-Reply-To: <20171211120612.3775893-1-arnd@arndb.de> References: <20171211120612.3775893-1-arnd@arndb.de> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2017-12-11 at 13:06 +0100, Arnd Bergmann wrote: > With CONFIG_KASAN enabled, we get a relatively large stack frame in one function > > drivers/media/tuners/tda8290.c: In function 'tda8290_set_params': > drivers/media/tuners/tda8290.c:310:1: warning: the frame size of 1520 bytes is larger than 1024 bytes [-Wframe-larger-than=] > > With CONFIG_KASAN_EXTRA this goes up to > > drivers/media/tuners/tda8290.c: In function 'tda8290_set_params': > drivers/media/tuners/tda8290.c:310:1: error: the frame size of 3200 bytes is larger than 3072 bytes [-Werror=frame-larger-than=] > > We can significantly reduce this by marking local arrays as 'static const', and > this should result in better compiled code for everyone. [] > diff --git a/drivers/media/tuners/tda8290.c b/drivers/media/tuners/tda8290.c [] > @@ -63,8 +63,8 @@ static int tda8290_i2c_bridge(struct dvb_frontend *fe, int close) > { > struct tda8290_priv *priv = fe->analog_demod_priv; > > - unsigned char enable[2] = { 0x21, 0xC0 }; > - unsigned char disable[2] = { 0x21, 0x00 }; > + static unsigned char enable[2] = { 0x21, 0xC0 }; > + static unsigned char disable[2] = { 0x21, 0x00 }; Doesn't match commit message. static const or just static? > @@ -84,9 +84,9 @@ static int tda8295_i2c_bridge(struct dvb_frontend *fe, int close) > { > struct tda8290_priv *priv = fe->analog_demod_priv; > > - unsigned char enable[2] = { 0x45, 0xc1 }; > - unsigned char disable[2] = { 0x46, 0x00 }; > - unsigned char buf[3] = { 0x45, 0x01, 0x00 }; > + static unsigned char enable[2] = { 0x45, 0xc1 }; > + static unsigned char disable[2] = { 0x46, 0x00 }; etc.