- 
                Notifications
    You must be signed in to change notification settings 
- Fork 931
Open
Labels
Description
In the function lfs_fs_preporphans, the value of lfs_gstate_hasorphans is left shifted 31 steps to set the high bit of the tag.
Line 4895 in 8e251dd
| ((uint32_t)lfs_gstate_hasorphans(&lfs->gstate) << 31)); | 
While lfs_gstate_hasorphans is defined as bool, it's value is actually same as lfs_tag_size, in other word 0 or any nonzero value.
Line 420 in 8e251dd
| return lfs_tag_size(a->tag); | 
This causes the high bit, to not be set at all. I've not investigated what issues this might cause. It was found while analyzing a weird clang-tidy warning:
"The result of the left shift is undefined due to shifting '0' by '31', which is unrepresentable in the unsigned version of the return type 'uint32_t'" on the left shift.