lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202201291928.NthcMZR8-lkp@intel.com>
Date:   Mon, 31 Jan 2022 15:44:51 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Qu Wenruo <wqu@...e.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, David Sterba <dsterba@...e.com>
Subject: [kdave:for-next 54/72] fs/btrfs/volumes.c:7404
 btrfs_read_sys_array() warn: passing zero to 'PTR_ERR'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
head:   d98f768106353f72c66948a22e4cd0aa29d7ed5c
commit: e9795fb3fbcde13580e04a3f5a520a99f98f4a93 [54/72] btrfs: use dummy extent buffer for super block sys chunk array read
config: openrisc-randconfig-m031-20220124 (https://download.01.org/0day-ci/archive/20220129/202201291928.NthcMZR8-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

New smatch warnings:
fs/btrfs/volumes.c:7404 btrfs_read_sys_array() warn: passing zero to 'PTR_ERR'

Old smatch warnings:
fs/btrfs/volumes.h:212 btrfs_device_set_total_bytes() warn: statement has no effect 31
fs/btrfs/volumes.h:213 btrfs_device_set_disk_total_bytes() warn: statement has no effect 31
fs/btrfs/volumes.h:214 btrfs_device_set_bytes_used() warn: statement has no effect 31
fs/btrfs/volumes.c:6431 __btrfs_map_block() error: 'em' dereferencing possible ERR_PTR()

vim +/PTR_ERR +7404 fs/btrfs/volumes.c

6bccf3ab1e1f09 Jeff Mahoney       2016-06-21  7379  int btrfs_read_sys_array(struct btrfs_fs_info *fs_info)
0b86a832a1f38a Chris Mason        2008-03-24  7380  {
ab8d0fc48dba09 Jeff Mahoney       2016-09-20  7381  	struct btrfs_super_block *super_copy = fs_info->super_copy;
a061fc8da7b990 Chris Mason        2008-05-07  7382  	struct extent_buffer *sb;
0b86a832a1f38a Chris Mason        2008-03-24  7383  	struct btrfs_disk_key *disk_key;
0b86a832a1f38a Chris Mason        2008-03-24  7384  	struct btrfs_chunk *chunk;
1ffb22cf8c322b David Sterba       2014-10-31  7385  	u8 *array_ptr;
1ffb22cf8c322b David Sterba       2014-10-31  7386  	unsigned long sb_array_offset;
84eed90fac1b92 Chris Mason        2008-04-25  7387  	int ret = 0;
0b86a832a1f38a Chris Mason        2008-03-24  7388  	u32 num_stripes;
0b86a832a1f38a Chris Mason        2008-03-24  7389  	u32 array_size;
0b86a832a1f38a Chris Mason        2008-03-24  7390  	u32 len = 0;
1ffb22cf8c322b David Sterba       2014-10-31  7391  	u32 cur_offset;
e06cd3dd7cea50 Liu Bo             2016-06-03  7392  	u64 type;
84eed90fac1b92 Chris Mason        2008-04-25  7393  	struct btrfs_key key;
0b86a832a1f38a Chris Mason        2008-03-24  7394  
0b246afa62b0cf Jeff Mahoney       2016-06-22  7395  	ASSERT(BTRFS_SUPER_INFO_SIZE <= fs_info->nodesize);
e9795fb3fbcde1 Qu Wenruo          2022-01-13  7396  
a83fffb75d09cd David Sterba       2014-06-15  7397  	/*
e9795fb3fbcde1 Qu Wenruo          2022-01-13  7398  	 * We allocated a dummy extent, just to use extent buffer accessors.
e9795fb3fbcde1 Qu Wenruo          2022-01-13  7399  	 * There will be unused space after BTRFS_SUPER_INFO_SIZE, but
e9795fb3fbcde1 Qu Wenruo          2022-01-13  7400  	 * that's fine, we will not go beyond system chunk array anyway.
a83fffb75d09cd David Sterba       2014-06-15  7401  	 */
e9795fb3fbcde1 Qu Wenruo          2022-01-13  7402  	sb = alloc_dummy_extent_buffer(fs_info, BTRFS_SUPER_INFO_OFFSET);
e9795fb3fbcde1 Qu Wenruo          2022-01-13  7403  	if (!sb)
c871b0f2fd27e7 Liu Bo             2016-06-06 @7404  		return PTR_ERR(sb);

Return -ENOMEM;  The current return PTR_ERR(NULL) means success.

4db8c528cdccb4 David Sterba       2015-12-03  7405  	set_extent_buffer_uptodate(sb);
4008c04a07c73e Chris Mason        2009-02-12  7406  
a061fc8da7b990 Chris Mason        2008-05-07  7407  	write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);
0b86a832a1f38a Chris Mason        2008-03-24  7408  	array_size = btrfs_super_sys_array_size(super_copy);
0b86a832a1f38a Chris Mason        2008-03-24  7409  
1ffb22cf8c322b David Sterba       2014-10-31  7410  	array_ptr = super_copy->sys_chunk_array;
1ffb22cf8c322b David Sterba       2014-10-31  7411  	sb_array_offset = offsetof(struct btrfs_super_block, sys_chunk_array);
1ffb22cf8c322b David Sterba       2014-10-31  7412  	cur_offset = 0;

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ