Re: [bug report] btrfs: get fs_info from block group in write_pinned_extent_entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 24, 2019 at 12:52:54PM +0300, Dan Carpenter wrote:
> Hello David Sterba,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch b4c7c5d50791: "btrfs: get fs_info from block group in
> write_pinned_extent_entries" from Mar 20, 2019, leads to the
> following Smatch complaint:
> 
>     fs/btrfs/free-space-cache.c:1052 write_pinned_extent_entries()
>     warn: variable dereferenced before check 'block_group' (see line 1047)
> 
> fs/btrfs/free-space-cache.c
>   1046	{
>   1047		struct btrfs_fs_info *fs_info = block_group->fs_info;
>                                                 ^^^^^^^^^^^^^^^^^^^^
> The patch adds a dereference
> 
>   1048		u64 start, extent_start, extent_end, len;
>   1049		struct extent_io_tree *unpin = NULL;
>   1050		int ret;
>   1051	
>   1052		if (!block_group)
>                      ^^^^^^^^^^^
> But the old code assumed it could be NULL.

Thanks for the report. The pointer will never be null as the caller will
pass a valid pointer, so the dereference is ok. This extra check is
redundant so I'll remove it.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux