cmd: mtd: fix default read behavior and boundary checks
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest0 of 2 patches 0 repliesNew
Patches in v1 No applies recorded yet
None of the 2 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] cmd: mtd: fix default read behavior and boundary checks
This series addresses two issues in the 'mtd read' command regarding how default read lengths are calculated and handled when no size argument is provided.
The first patch fixes a failure when reading a full NAND partition that contains bad blocks. Currently, skipping bad blocks increments the physical offset without adjusting the remaining byte count, causing the read to attempt accessing past the end of the partition. The fix ensures that default full-partition reads are truncated gracefully at the physical boundary rather than returning an error.
This behaviour is similar to the raw nand command which adjusts the size of the read with adjust_size_for_badblocks().
The second patch fixes the default length calculation when a starting offset is specified. Previously, the command defaulted to reading the entire partition size ('mtd->size') starting from the offset, which inevitably exceeds the partition bounds. The fix adjusts the default length to 'mtd->size - offset'.
Peter Suti (2):
cmd: mtd: fix read failure on default full partition read with bad
blocks
cmd: mtd: fix default length calculation when offset is specified
cmd/mtd.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0