[PATCH 0/3] mtdchar: keep data and OOB aligned across ioctl chunks
James Hilliard
james.hilliard1 at gmail.com
Fri Nov 6 21:20:38 PST 2026
MEMREAD and MEMWRITE split requests into bounded data and OOB buffers.
Their chunk lengths and flash-address updates must keep both streams
associated with the same pages.
An intermediate read can consume OOB from pages beyond its data chunk.
OOB-only requests do not advance the flash address between chunks, while
a buffer ending within a page's OOB can leave the next operation starting
at the wrong page. When the OOB buffer is the limiting factor, the data
chunk must stop at the same page boundary.
The OOB-limited case was found while testing a proposed BootROM-format
MTD view with 1024 data bytes and 1152 OOB bytes per page. A 64-page
request has 65536 data bytes and 73728 OOB bytes, but the original
65536-byte buffer limit lets the first operation consume all the data
while transferring only part of the OOB.
First simplify the page-capacity calculation, then bound OOB in
intermediate reads to their data pages. Finally keep non-final OOB chunks
page-aligned, limit their accompanying data and advance OOB-only requests
by the pages transferred.
Assisted-by: Codex:gpt-6-astra
Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
---
James Hilliard (3):
mtdchar: calculate OOB capacity from the starting column
mtdchar: bound OOB reads to the data in intermediate chunks
mtdchar: keep OOB chunks aligned with their data pages
drivers/mtd/mtdchar.c | 65 ++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 54 insertions(+), 11 deletions(-)
---
base-commit: 1c1a342aceec79528b3ba51f376eca2be5928fe7
change-id: 20261106-submit-mtdchar-page-chunking-v1-668636b0becd
Best regards,
--
James Hilliard <james.hilliard1 at gmail.com>
More information about the linux-mtd
mailing list