Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fs/fcb: Clean fcb_append inconsistency
Variable cnt and len were reused leading to some inconsistencies. 1. cnt was number of bytes needed to store len but it was later changed to store number of bytes in flash to store len (that can be larger when flash alignment restrictions are applied). Later it was used to actually write len filed to flash, however if alignment was not 1 or 2 some random data would be written to flash (starting from tmp_str but extending to other values on stack). No there is separate variable to keep track how many bytes in flash are needed. 2. calculating whether entry will fit in current sector, fcb_disk_area was not aligned correctly that could lead to problems for flash that has alignment that is higher then 8. 3. append_loc was partially updated but fe_data_len was never filled leaving structure in inconsistent state. 4. active->fe_data_len could have incorrect value (rounded up to alignment) This was small inconsistency that probably would not result in any problem Signed-off-by: Jerzy Kasenberg <[email protected]>
- Loading branch information