diff options
| author | Filipe Manana <fdmanana@suse.com> | 2026-09-29 15:58:34 +0100 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-10-12 19:16:23 +0200 |
| commit | d1d74665ab9a8971d42177ca865cfbe2897c1fc7 (patch) | |
| tree | 3339b92ad7c02d720d749118a9396e7869c9a5bf /tools/perf/scripts/python/stackcollapse.py | |
| parent | 9bdef63e2b5d4a88810329a1cab3642d6378a895 (diff) | |
| download | linux-d1d74665ab9a8971d42177ca865cfbe2897c1fc7.tar.gz linux-d1d74665ab9a8971d42177ca865cfbe2897c1fc7.zip | |
btrfs: fix incomplete iteration over fs state when logging messages
In btrfs_state_to_string() we iterate over all the bits set in
fs_info->fs_state using for_each_set_bit(), which requires its third
argument to match the number of bits, but we pass it the number of bytes
of the type used by fs_info->fs_state, an unsigned long, which is 8 on
64 bits platforms and 4 on 32 bits platforms. This means we are not
iterating over bits in the ranges [8, 63] or [4, 31].
Fix this by passing BTRFS_FS_STATE_COUNT instead of sizeof(fs_state).
Note that we could pass BITS_PER_TYPE(fs_state), but since
BTRFS_FS_STATE_COUNT is 11 and we have no bits beyond that, it would
cause pointless iterations over fs_state.
This also makes pointless the checks for the bit being inside the limit
of BTRFS_FS_STATE_COUNT inside the loop.
Fixes: c067da878156 ("btrfs: add filesystems state details to error messages")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
