On Wed, Jul 19, 2017 at 04:13:07PM +0300, Dan Carpenter wrote:
> Hello David Sterba,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch c042dd070450: "btrfs: get fs_info from eb in
> btrfs_print_leaf, remove argument" from Jun 29, 2017, leads to the
> following Smatch complaint:
>
> fs/btrfs/print-tree.c:181 btrfs_print_leaf()
> warn: variable dereferenced before check 'l' (see line 166)
>
> fs/btrfs/print-tree.c
> 165 {
> 166 struct btrfs_fs_info *fs_info = l->fs_info;
> ^^^^^^^^^^
> New dereference.
>
> 167 int i;
> 168 u32 type, nr;
> 169 struct btrfs_item *item;
> 170 struct btrfs_root_item *ri;
> 171 struct btrfs_dir_item *di;
> 172 struct btrfs_inode_item *ii;
> 173 struct btrfs_block_group_item *bi;
> 174 struct btrfs_file_extent_item *fi;
> 175 struct btrfs_extent_data_ref *dref;
> 176 struct btrfs_shared_data_ref *sref;
> 177 struct btrfs_dev_extent *dev_extent;
> 178 struct btrfs_key key;
> 179 struct btrfs_key found_key;
> 180
> 181 if (!l)
> ^^
> Checked too late.
Thanks, I've moved the fs_info initialization after this check. In both
patches (btrfs_print_leaf and btrfs_print_tree).
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html