Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gcc-9: don't warn about uninitialized btrfs extent_type variable

The 'extent_type' variable does seem to be reliably initialized, but
it's _very_ non-obvious, since there's a "goto next" case that jumps
over the normal initialization. That will then always trigger the
"start >= extent_end" test, which will end up never falling through to
the use of that variable.

But the code is certainly not obvious, and the compiler warning looks
reasonable. Make 'extent_type' an int, and initialize it to an invalid
negative value, which seems to be the common pattern in other places.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+1 -1
+1 -1
fs/btrfs/inode.c
··· 6783 6783 u64 extent_start = 0; 6784 6784 u64 extent_end = 0; 6785 6785 u64 objectid = btrfs_ino(inode); 6786 - u8 extent_type; 6786 + int extent_type = -1; 6787 6787 struct btrfs_path *path = NULL; 6788 6788 struct btrfs_root *root = inode->root; 6789 6789 struct btrfs_file_extent_item *item;