btrfs-progs: tree-stats: initialize the key properly

I started hitting a segfault on fuzz test 006 because we couldn't find
the extent root.  This is because the global root search stuff expects
the actual key to be setup properly, not just an objectid.  Fix this by
initializing the key properly so we can find the extent root and other
trees properly.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2022-02-22 17:22:42 -05:00 committed by David Sterba
parent ee21714e21
commit d1235141ab

View file

@ -447,7 +447,7 @@ static const char * const cmd_inspect_tree_stats_usage[] = {
static int cmd_inspect_tree_stats(const struct cmd_struct *cmd,
int argc, char **argv)
{
struct btrfs_key key;
struct btrfs_key key = { .type = BTRFS_ROOT_ITEM_KEY };
struct btrfs_root *root;
int opt;
int ret = 0;