[PATCH] mtd: spi-nor: sfdp: reduce stack usage in spi_nor_parse_sfdp()

Miquel Raynal miquel.raynal at bootlin.com
Thu Oct 15 03:04:57 PDT 2026


On 15/10/2026 at 11:01:28 +02, Michael Walle <mwalle at kernel.org> 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 at arndb.de>
> Suggested-by: David Laight <david.laight.linux at gmail.com>
> Fixes: d20029474a76 ("mtd: spi-nor: push the rollback mechanism into the sfdp module")
> Signed-off-by: Michael Walle <mwalle at kernel.org>

Sashiko is correct about the need for not mixing __free and goto's. With
this fixed,

Reviewed-by: Miquel Raynal <miquel.raynal at bootlin.com>



More information about the linux-mtd mailing list