[PATCH] mtd: cfi: use struct_size() helper for cfiq allocation

Miquel Raynal miquel.raynal at bootlin.com
Mon Sep 29 09:03:07 PDT 2025


On Fri, 19 Sep 2025 00:14:14 +0530, Gopi Krishna Menon wrote:
> Documentation/process/deprecated.rst recommends against performing
> dynamic size calculations in the arguments of memory allocator
> function due to the risk of overflow. Such calculations can
> wrap around and result in a smaller allocation than what the caller
> was expecting.
> 
> Replace the size calculation in cfiq allocation with struct_size()
> helper to make the code clearer and handle the overflows correctly.
> 
> [...]

Applied to mtd/next, thanks!

[1/1] mtd: cfi: use struct_size() helper for cfiq allocation
      commit: d496b6f42eb0455caf5d8cb30cf1f01b7fc2a747

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl




More information about the linux-mtd mailing list