btrfs-progs/kernel-shared
Qu Wenruo 66dad3a8f5 btrfs-progs: fix a false alert on an uninitialized variable when BUG_ON() is involved
[FALSE ALERT]
Clang 15.0.7 gives the following false alert in get_dev_extent_len():

  kernel-shared/extent-tree.c:3328:2: warning: variable 'div' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
          default:
          ^~~~~~~
  kernel-shared/extent-tree.c:3332:24: note: uninitialized use occurs here
          return map->ce.size / div;
                                ^~~
  kernel-shared/extent-tree.c:3311:9: note: initialize the variable 'div' to silence this warning
          int div;
                 ^
                  = 0

And one in btrfs_stripe_length() too:

  kernel-shared/volumes.c:2781:2: warning: variable 'stripe_len' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
          default:
          ^~~~~~~
  kernel-shared/volumes.c:2785:9: note: uninitialized use occurs here
          return stripe_len;
                 ^~~~~~~~~~
  kernel-shared/volumes.c:2754:16: note: initialize the variable 'stripe_len' to silence this warning
          u64 stripe_len;
                        ^
                         = 0

[CAUSE]
Clang doesn't really understand what BUG_ON() means, thus in that
default case, we won't get uninitialized value but crash directly.

[FIX]
Silent the errors by assigning the default value properly using the
value of SINGLE profile.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-18 17:44:02 +01:00
..
backref.c
backref.h
compression.h btrfs-progs: kerncompat: hide definition of __init 2023-01-03 17:24:36 +01:00
ctree.c btrfs-progs: remove an unnecessary branch to silent the clang warning 2023-02-18 17:44:02 +01:00
ctree.h Revert "btrfs-progs: rename qgroup items to match the kernel naming scheme" 2023-01-03 13:10:54 +01:00
delayed-ref.c
delayed-ref.h
dir-item.c
disk-io.c btrfs-progs: rename extent buffer flags to EXTENT_BUFFER_* 2022-11-28 18:57:44 +01:00
disk-io.h btrfs-progs: btrfstune: add the ability to convert to block group tree feature 2022-09-12 18:25:32 +02:00
extent-tree.c btrfs-progs: fix a false alert on an uninitialized variable when BUG_ON() is involved 2023-02-18 17:44:02 +01:00
extent_io.c btrfs-progs: make write_extent_buffer take a const eb 2022-11-30 19:14:29 +01:00
extent_io.h btrfs-progs: make write_extent_buffer take a const eb 2022-11-30 19:14:29 +01:00
file-item.c btrfs-progs: kernel-lib: remove radix-tree 2022-10-11 09:08:07 +02:00
file.c btrfs-progs: sync compression.h from the kernel 2022-11-30 19:14:29 +01:00
free-space-cache.c
free-space-cache.h
free-space-tree.c btrfs-progs: fix may be unused warning in load_free_space_extents 2022-10-11 09:06:11 +02:00
free-space-tree.h btrfs-progs: properly initialize block group thresholds 2022-05-20 15:54:20 +02:00
inode-item.c
inode.c btrfs-progs: use template for transaction commit error messages 2022-10-11 09:08:10 +02:00
print-tree.c Revert "btrfs-progs: rename qgroup items to match the kernel naming scheme" 2023-01-03 13:10:54 +01:00
print-tree.h
root-tree.c
send.h btrfs-progs: receive: add support for fs-verity 2022-10-11 09:08:08 +02:00
transaction.c btrfs-progs: move dirty eb tracking to it's own io_tree 2022-11-28 18:57:43 +01:00
transaction.h
ulist.c
ulist.h
uuid-tree.c
volumes.c btrfs-progs: fix a false alert on an uninitialized variable when BUG_ON() is involved 2023-02-18 17:44:02 +01:00
volumes.h
zoned.c btrfs-progs: replace strerror(errno) with %m in printf formats 2022-10-26 09:46:22 +02:00
zoned.h