RTEMS | cpukit/jffs2: Fix unaligned writes (!728)
Christian Mauderer (@c-mauderer)
gitlab at rtems.org
Wed Sep 17 13:21:36 UTC 2025
Christian Mauderer created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/728
Project:Branches: c-mauderer/rtems:cm/jffs2-fix to rtems/rtos/rtems:main
Author: Christian Mauderer
## Summary
cpukit/jffs2: Fix unaligned writes
The code in flashio.c had a special case for handling unaligned buffers
during writes. That code did roughly the following:
If the size or start address of the buffer is not aligned to a word:
* align the size up to the next word
* create a temp buffer on heap or stack with the new size
* copy the data from write buffer to this temp buffer
* write the temp buffer with the _new_ size to the flash
* tell the code above, that the original size has been written
That means, that in certain cases, one to three random bytes have been
written to the flash. That is definitively not correct.
The special cases that trigger the behaviour seem to happen quite often
when using the RTEMS functions to unpack a .tar.gz with files in the
range of a few megabytes stored on the JFFS2 file system to the same
file system.
The RTEMS interface for flash drivers doesn't define any alignment
requirements. Therefore that code is not necessary and can just be
removed to solve these issues.
<!-- Default settings, if it is a dropdown it will set after submission -->
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/728
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250917/175eb42a/attachment.htm>
More information about the bugs
mailing list