[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20200907073412.27402-1-miquel.raynal@bootlin.com>
Date: Mon, 7 Sep 2020 09:34:12 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Arnd Bergmann <arnd@...db.de>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Vincenzo Aliberti <vincenzo.aliberti@...il.com>,
Brian Norris <computersforpeace@...il.com>
Cc: Richard Fontana <rfontana@...hat.com>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
clang-built-linux@...glegroups.com
Subject: Re: [PATCH] mtd: lpddr: fix excessive stack usage with clang
On Tue, 2020-05-05 at 14:01:16 UTC, Arnd Bergmann wrote:
> Building lpddr2_nvm with clang can result in a giant stack usage
> in one function:
>
> drivers/mtd/lpddr/lpddr2_nvm.c:399:12: error: stack frame size of 1144 bytes in function 'lpddr2_nvm_probe' [-Werror,-Wframe-larger-than=]
>
> The problem is that clang decides to build a copy of the mtd_info
> structure on the stack and then do a memcpy() into the actual version. It
> shouldn't really do it that way, but it's not strictly a bug either.
>
> As a workaround, use a static const version of the structure to assign
> most of the members upfront and then only set the few members that
> require runtime knowledge at probe time.
>
> Fixes: 96ba9dd65788 ("mtd: lpddr: add driver for LPDDR2-NVM PCM memories")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> Reviewed-by: Nathan Chancellor <natechancellor@...il.com>
> Acked-by: Miquel Raynal <miquel.raynal@...tlin.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
Powered by blists - more mailing lists