Re: [PATCH] mtd: spi-nor: sfdp: reduce stack usage in spi_nor_parse_sfdp()
From: Miquel Raynal
Date: Thu Oct 15 2026 - 06:20:12 EST
On 15/10/2026 at 11:01:28 +02, Michael Walle <mwalle@xxxxxxxxxx> wrote:
> Two large spi_nor_flash_parameter structures on a function stack
> are really too much, and this can exceed an otherwise reasonable
> frame limit:
>
> drivers/mtd/spi-nor/sfdp.c: In function 'spi_nor_parse_sfdp':
> drivers/mtd/spi-nor/sfdp.c:1717:1: error: the frame size of 1600 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
>
> Allocate both rollback copies on the heap and use structure copies
> for type safety.
>
> Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
> Suggested-by: David Laight <david.laight.linux@xxxxxxxxx>
> Fixes: d20029474a76 ("mtd: spi-nor: push the rollback mechanism into the sfdp module")
> Signed-off-by: Michael Walle <mwalle@xxxxxxxxxx>
Sashiko is correct about the need for not mixing __free and goto's. With
this fixed,
Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>