xhh233 opened a new pull request, #22371: URL: https://github.com/apache/nuttx/pull/22371
## Summary Both `mtdconfig_setconfig()` (overwriting an existing entry) and `mtdconfig_deleteconfig()` mark an entry as released by writing a single flag byte, but neither checks the return value of `mtdconfig_writebytes()`. A failed write is therefore reported as success, and the old entry stays valid while the caller believes the value was overwritten or deleted — a stale value read after a reported success. Both paths now check the returned byte count and report `-EIO` when the marker could not be written. ## Impact Error handling only. Successful overwrite and delete behave exactly as before; a failed marker write now returns `-EIO` instead of `OK`. ## Testing Deterministic MTD shim that fails the single-byte marker write: * before: `setconfig()` / `deleteconfig()` return `OK`, and a following `getconfig()` still returns the old value * after: both return `-EIO`, and `getconfig()` returns the old value because the marker never reached flash The shim models the driver logic at the MTD write boundary; no board or QEMU run is claimed. ## AI declaration AI tools were used: OpenAI GPT (codex CLI) for review of the claim and of the change before submission, and opencode agents driving DeepSeek models for source analysis and drafting. The final change was reviewed by the contributor and verified with the host shim described above. Issue reference: #22315. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
