diff options
author | Fan Deng <enetor@gmail.com> | 2017-10-10 16:28:34 -0700 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2018-04-11 11:51:57 +1000 |
commit | 64908df11675c36f5b9ca7ec1545ea6b07f9a89a (patch) | |
tree | c756ae7174bf45027468af4f17ce506131590a49 /c/src/lib | |
parent | Reset free count properly in rtems_rfs_bitmap_map_clear_all(). (diff) | |
download | rtems-64908df11675c36f5b9ca7ec1545ea6b07f9a89a.tar.bz2 |
Fixes bitmap allocation accounting logic in rtems-rfs-bitmaps.c
The bitmap allocation accounting logic in rtems-rfs-bitmaps.c is flawed
around control->free. Specifically:
In rtems_rfs_bitmap_map_set():
control->free is only decremented when its corresponding search bit is
toggled. This is wrong and will miss on average 31/32 set updates.
In rtems_rfs_bitmap_map_clear():
control->free is incremented unconditionally.
The correct behavior is:
When updating the map, check if the bit is already set/clear. Only update
control->free when the bit is toggled.
This change enforced the correct behavior.
Tested by inspecting the internal data structure.
Diffstat (limited to 'c/src/lib')
0 files changed, 0 insertions, 0 deletions