On 16/12/2025 at 14:40:42 +01, Peter Suti <[email protected]>
wrote:
> When the 'mtd read' command is issued with an offset but no size (argc=1),
> the length defaults to the full partition size ('mtd->size').
>
> This calculation is incorrect because reading 'mtd->size' bytes starting
> from a non-zero offset results in a read request that extends past the
> end of the partition. This causes the MTD layer to return error -22
> (EINVAL).
>
> Fix the default length calculation to be 'mtd->size - offset' so that
> reads starting from an offset effectively read "to the end of the
> partition" rather than attempting to read out of bounds.
>
> Signed-off-by: Peter Suti <[email protected]>
> [add {} for better readability]
> Signed-off-by: Radek Dostál <[email protected]>
Makes sense.
Acked-by: Miquel Raynal <[email protected]>