Re: [PATCH] mtd: rawnand: nandsim: reject unrepresentable page counts

From: Miquel Raynal

Date: Fri Dec 04 2026 - 16:33:19 EST


On Sun, 08 Nov 2026 15:39:52 -0700, James Hilliard wrote:
> The simulator stores its total page count in an unsigned int and uses
> signed int indices to initialize and free the page array. A device size
> accepted by overridesize can exceed both limits even when the eraseblock
> count is representable. In particular, a power-of-two page count above
> UINT_MAX truncates to zero and reaches a zero-sized allocation.
>
> Reject page counts above INT_MAX before allocating wear counters or page
> storage. This preserves the full page count and keeps the page-array
> indices representable, while reporting invalid geometry as -EINVAL.
>
> [...]

Applied to nand/next, thanks!

[1/1] mtd: rawnand: nandsim: reject unrepresentable page counts
commit: b1d7586014476ee02fbb2677d75c378eb60b045a

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