Re: [PATCH] mtd: cfi_cmdset_0001: shrink do_write_buffer() stack frame
From: Miquel Raynal
Date: Tue Aug 25 2026 - 08:36:08 EST
Hi David & Vignesh,
On 24/08/2026 at 08:56:32 +01, David Laight <david.laight.linux@xxxxxxxxx> wrote:
> On Mon, 24 Aug 2026 03:47:03 +0200
> Karl Mehltretter <kmehltretter@xxxxxxxxx> wrote:
>
>> arm32 allmodconfig fails to build with gcc:
>>
>> drivers/mtd/chips/cfi_cmdset_0001.c:1883:1: error: the frame size of 1296
>> bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
>>
>> With MTD_MAP_BANK_WIDTH_32 a map_word is 32 bytes, and with KASAN_STACK
>> every temporary gets its own redzoned slot. do_write_buffer() builds a
>> map_word for each of the twelve commands it issues, and those temporaries
>> dominate its frame.
>
> Looks to me like pretty much all of mtd/map.h should be real functions
> and not #defines or inlines.
>
> The bloat from all those expansions is going to be significant.
> They only time they get optimised to anything small is when only
> CONFIG_MTD_MAP_BANK_WIDTH_1 is set.
>
> The execution time of all those that do real io (especially reads)
> will be dominated by the io access itself.
David, may I ask if you acknowledge the fix?
Vignesh, same question, maybe you also test that there is no apparent
regression?
Thanks,
Miquèl