All of lore.kernel.org
 help / color / mirror / Atom feed
* [osandov:btrfs-send-encoded-v10 8/14] fs/btrfs/inode.c:10739:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-08-19 13:42 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-19 13:42 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17499 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: Omar Sandoval <osandov@osandov.com>
CC: linux-kernel(a)vger.kernel.org
TO: Omar Sandoval <osandov@fb.com>

tree:   https://github.com/osandov/linux.git btrfs-send-encoded-v10
head:   a87f8dd5b9e777c136ab986baa9b751f9c1909a6
commit: 6716dfd581687f8662d3c828ca2f9911ba58c721 [8/14] btrfs: add BTRFS_IOC_ENCODED_READ
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: powerpc-randconfig-c003-20210818 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d2b574a4dea5b718e4386bf2e26af0126e5978ce)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://github.com/osandov/linux/commit/6716dfd581687f8662d3c828ca2f9911ba58c721
        git remote add osandov https://github.com/osandov/linux.git
        git fetch --no-tags osandov btrfs-send-encoded-v10
        git checkout 6716dfd581687f8662d3c828ca2f9911ba58c721
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                      ^~~~
   fs/btrfs/inode.c:6469:2: note: Taking true branch
           if (dir && name) {
           ^
   fs/btrfs/inode.c:6472:9: note: Calling 'btrfs_set_inode_index'
                   ret = btrfs_set_inode_index(BTRFS_I(dir), index);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:6365:6: note: Assuming the condition is true
           if (dir->index_cnt == (u64)-1) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:6365:2: note: Taking true branch
           if (dir->index_cnt == (u64)-1) {
           ^
   fs/btrfs/inode.c:6367:7: note: Assuming 'ret' is not equal to 0
                   if (ret) {
                       ^~~
   fs/btrfs/inode.c:6367:3: note: Taking true branch
                   if (ret) {
                   ^
   fs/btrfs/inode.c:6369:8: note: 'ret' is not equal to 0
                           if (ret)
                               ^~~
   fs/btrfs/inode.c:6369:4: note: Taking true branch
                           if (ret)
                           ^
   fs/btrfs/inode.c:6370:5: note: Returning without writing to '*index'
                                   return ret;
                                   ^
   fs/btrfs/inode.c:6472:9: note: Returning from 'btrfs_set_inode_index'
                   ret = btrfs_set_inode_index(BTRFS_I(dir), index);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:6473:7: note: 'ret' is not equal to 0
                   if (ret) {
                       ^~~
   fs/btrfs/inode.c:6473:3: note: Taking true branch
                   if (ret) {
                   ^
   fs/btrfs/inode.c:6476:4: note: Returning without writing to '*index'
                           return ERR_PTR(ret);
                           ^
   fs/btrfs/inode.c:9570:10: note: Returning from 'btrfs_new_inode'
           inode = btrfs_new_inode(trans, root, mnt_userns, dir,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:9578:6: note: Calling 'IS_ERR'
           if (IS_ERR(inode)) {
               ^~~~~~~~~~~~~
   include/linux/err.h:36:9: note: Assuming the condition is false
           return IS_ERR_VALUE((unsigned long)ptr);
                  ^
   include/linux/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE'
   #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
                           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
           return IS_ERR_VALUE((unsigned long)ptr);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:9578:6: note: Returning from 'IS_ERR'
           if (IS_ERR(inode)) {
               ^~~~~~~~~~~~~
   fs/btrfs/inode.c:9578:2: note: Taking false branch
           if (IS_ERR(inode)) {
           ^
   fs/btrfs/inode.c:9587:8: note: Calling 'btrfs_init_inode_security'
           ret = btrfs_init_inode_security(trans, inode, dir,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:226:6: note: Assuming 'err' is 0, which participates in a condition later
           if (!err)
               ^~~~
   fs/btrfs/inode.c:226:2: note: Taking true branch
           if (!err)
           ^
   fs/btrfs/inode.c:228:2: note: Returning value (loaded from 'err'), which participates in a condition later
           return err;
           ^~~~~~~~~~
   fs/btrfs/inode.c:9587:8: note: Returning from 'btrfs_init_inode_security'
           ret = btrfs_init_inode_security(trans, inode, dir,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:9589:6: note: Assuming 'ret' is 0
           if (ret)
               ^~~
   fs/btrfs/inode.c:9589:2: note: Taking false branch
           if (ret)
           ^
   fs/btrfs/inode.c:9592:8: note: 6th function call argument is an uninitialized value
           ret = btrfs_add_nondir(trans, BTRFS_I(dir), dentry,
                 ^
   fs/btrfs/inode.c:9658:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = 0;
           ^     ~
   fs/btrfs/inode.c:9658:2: note: Value stored to 'ret' is never read
           ret = 0;
           ^     ~
   fs/btrfs/inode.c:9829:3: warning: Value stored to 'log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
                   log_pinned = false;
                   ^            ~~~~~
   fs/btrfs/inode.c:9829:3: note: Value stored to 'log_pinned' is never read
                   log_pinned = false;
                   ^            ~~~~~
>> fs/btrfs/inode.c:10739:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   remaining = min(geom.len, disk_io_size - cur);
                               ^
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^
   include/linux/minmax.h:31:3: note: expanded from macro '__cmp_once'
                   typeof(x) unique_x = (x);               \
                   ^
   fs/btrfs/inode.c:10863:6: note: Assuming field 'ki_pos' is < field 'i_size'
           if (iocb->ki_pos >= inode->i_size) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10863:2: note: Taking false branch
           if (iocb->ki_pos >= inode->i_size) {
           ^
   fs/btrfs/inode.c:10874:2: note: Loop condition is true.  Entering loop body
           for (;;) {
           ^
   fs/btrfs/inode.c:10879:7: note: Assuming 'ret' is 0
                   if (ret)
                       ^~~
   fs/btrfs/inode.c:10879:3: note: Taking false branch
                   if (ret)
                   ^
   fs/btrfs/inode.c:10884:7: note: Assuming 'ordered' is null
                   if (!ordered)
                       ^~~~~~~~
   fs/btrfs/inode.c:10884:3: note: Taking true branch
                   if (!ordered)
                   ^
   fs/btrfs/inode.c:10885:4: note:  Execution continues on line 10891
                           break;
                           ^
   fs/btrfs/inode.c:10893:2: note: Taking false branch
           if (IS_ERR(em)) {
           ^
   fs/btrfs/inode.c:10898:6: note: Assuming the condition is false
           if (em->block_start == EXTENT_MAP_INLINE) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10898:2: note: Taking false branch
           if (em->block_start == EXTENT_MAP_INLINE) {
           ^
   fs/btrfs/inode.c:10917:18: note: '__UNIQUE_ID___x899' is >= '__UNIQUE_ID___y900'
           encoded->len = (min_t(u64, extent_map_end(em), inode->i_size) -
                           ^
   include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
   #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^~~
   fs/btrfs/inode.c:10917:18: note: '?' condition is false
           encoded->len = (min_t(u64, extent_map_end(em), inode->i_size) -
                           ^
   include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
   #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                   ^
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^
   include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })
                   ^
   include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^
   fs/btrfs/inode.c:10919:6: note: Assuming the condition is false
           if (em->block_start == EXTENT_MAP_HOLE ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10919:6: note: Left side of '||' is false
   fs/btrfs/inode.c:10920:6: note: Assuming the condition is false
               test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10919:2: note: Taking false branch
           if (em->block_start == EXTENT_MAP_HOLE ||
           ^
   fs/btrfs/inode.c:10924:13: note: Assuming the condition is true
           } else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10924:9: note: Taking true branch
           } else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
                  ^
   fs/btrfs/inode.c:10930:7: note: Assuming 'count' is >= field 'block_len'
                   if (em->block_len > count) {
                       ^~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10930:3: note: Taking false branch
                   if (em->block_len > count) {
                   ^
   fs/btrfs/inode.c:10939:7: note: 'ret' is >= 0
                   if (ret < 0)
                       ^~~
   fs/btrfs/inode.c:10939:3: note: Taking false branch

vim +10739 fs/btrfs/inode.c

6716dfd581687f Omar Sandoval 2019-10-09  10701  
6716dfd581687f Omar Sandoval 2019-10-09  10702  static int btrfs_encoded_read_regular_fill_pages(struct inode *inode, u64 offset,
6716dfd581687f Omar Sandoval 2019-10-09  10703  						 u64 disk_io_size, struct page **pages)
6716dfd581687f Omar Sandoval 2019-10-09  10704  {
6716dfd581687f Omar Sandoval 2019-10-09  10705  	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
6716dfd581687f Omar Sandoval 2019-10-09  10706  	struct btrfs_encoded_read_private priv = {
6716dfd581687f Omar Sandoval 2019-10-09  10707  		.inode = inode,
6716dfd581687f Omar Sandoval 2019-10-09  10708  		.pending = ATOMIC_INIT(1),
6716dfd581687f Omar Sandoval 2019-10-09  10709  		.skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM,
6716dfd581687f Omar Sandoval 2019-10-09  10710  	};
6716dfd581687f Omar Sandoval 2019-10-09  10711  	unsigned long i = 0;
6716dfd581687f Omar Sandoval 2019-10-09  10712  	u64 cur = 0;
6716dfd581687f Omar Sandoval 2019-10-09  10713  	int ret;
6716dfd581687f Omar Sandoval 2019-10-09  10714  
6716dfd581687f Omar Sandoval 2019-10-09  10715  	init_waitqueue_head(&priv.wait);
6716dfd581687f Omar Sandoval 2019-10-09  10716  	/*
6716dfd581687f Omar Sandoval 2019-10-09  10717  	 * Submit bios for the extent, splitting due to bio or stripe limits as
6716dfd581687f Omar Sandoval 2019-10-09  10718  	 * necessary.
6716dfd581687f Omar Sandoval 2019-10-09  10719  	 */
6716dfd581687f Omar Sandoval 2019-10-09  10720  	while (cur < disk_io_size) {
6716dfd581687f Omar Sandoval 2019-10-09  10721  		struct extent_map *em;
6716dfd581687f Omar Sandoval 2019-10-09  10722  		struct btrfs_io_geometry geom;
6716dfd581687f Omar Sandoval 2019-10-09  10723  		struct bio *bio = NULL;
6716dfd581687f Omar Sandoval 2019-10-09  10724  		u64 remaining;
6716dfd581687f Omar Sandoval 2019-10-09  10725  
6716dfd581687f Omar Sandoval 2019-10-09  10726  		em = btrfs_get_chunk_map(fs_info, offset + cur,
6716dfd581687f Omar Sandoval 2019-10-09  10727  					 disk_io_size - cur);
6716dfd581687f Omar Sandoval 2019-10-09  10728  		if (IS_ERR(em)) {
6716dfd581687f Omar Sandoval 2019-10-09  10729  			ret = PTR_ERR(em);
6716dfd581687f Omar Sandoval 2019-10-09  10730  		} else {
6716dfd581687f Omar Sandoval 2019-10-09  10731  			ret = btrfs_get_io_geometry(fs_info, em, BTRFS_MAP_READ,
6716dfd581687f Omar Sandoval 2019-10-09  10732  						    offset + cur, &geom);
6716dfd581687f Omar Sandoval 2019-10-09  10733  			free_extent_map(em);
6716dfd581687f Omar Sandoval 2019-10-09  10734  		}
6716dfd581687f Omar Sandoval 2019-10-09  10735  		if (ret) {
6716dfd581687f Omar Sandoval 2019-10-09  10736  			WRITE_ONCE(priv.status, errno_to_blk_status(ret));
6716dfd581687f Omar Sandoval 2019-10-09  10737  			break;
6716dfd581687f Omar Sandoval 2019-10-09  10738  		}
6716dfd581687f Omar Sandoval 2019-10-09 @10739  		remaining = min(geom.len, disk_io_size - cur);
6716dfd581687f Omar Sandoval 2019-10-09  10740  		while (bio || remaining) {
6716dfd581687f Omar Sandoval 2019-10-09  10741  			size_t bytes = min_t(u64, remaining, PAGE_SIZE);
6716dfd581687f Omar Sandoval 2019-10-09  10742  
6716dfd581687f Omar Sandoval 2019-10-09  10743  			if (!bio) {
6716dfd581687f Omar Sandoval 2019-10-09  10744  				bio = btrfs_bio_alloc(offset + cur);
6716dfd581687f Omar Sandoval 2019-10-09  10745  				bio->bi_end_io = btrfs_encoded_read_endio;
6716dfd581687f Omar Sandoval 2019-10-09  10746  				bio->bi_private = &priv;
6716dfd581687f Omar Sandoval 2019-10-09  10747  				bio->bi_opf = REQ_OP_READ;
6716dfd581687f Omar Sandoval 2019-10-09  10748  			}
6716dfd581687f Omar Sandoval 2019-10-09  10749  
6716dfd581687f Omar Sandoval 2019-10-09  10750  			if (!bytes ||
6716dfd581687f Omar Sandoval 2019-10-09  10751  			    bio_add_page(bio, pages[i], bytes, 0) < bytes) {
6716dfd581687f Omar Sandoval 2019-10-09  10752  				blk_status_t status;
6716dfd581687f Omar Sandoval 2019-10-09  10753  
6716dfd581687f Omar Sandoval 2019-10-09  10754  				status = submit_encoded_read_bio(inode, bio, 0,
6716dfd581687f Omar Sandoval 2019-10-09  10755  								 0);
6716dfd581687f Omar Sandoval 2019-10-09  10756  				if (status) {
6716dfd581687f Omar Sandoval 2019-10-09  10757  					WRITE_ONCE(priv.status, status);
6716dfd581687f Omar Sandoval 2019-10-09  10758  					bio_put(bio);
6716dfd581687f Omar Sandoval 2019-10-09  10759  					goto out;
6716dfd581687f Omar Sandoval 2019-10-09  10760  				}
6716dfd581687f Omar Sandoval 2019-10-09  10761  				bio = NULL;
6716dfd581687f Omar Sandoval 2019-10-09  10762  				continue;
6716dfd581687f Omar Sandoval 2019-10-09  10763  			}
6716dfd581687f Omar Sandoval 2019-10-09  10764  
6716dfd581687f Omar Sandoval 2019-10-09  10765  			i++;
6716dfd581687f Omar Sandoval 2019-10-09  10766  			cur += bytes;
6716dfd581687f Omar Sandoval 2019-10-09  10767  			remaining -= bytes;
6716dfd581687f Omar Sandoval 2019-10-09  10768  		}
6716dfd581687f Omar Sandoval 2019-10-09  10769  	}
6716dfd581687f Omar Sandoval 2019-10-09  10770  
6716dfd581687f Omar Sandoval 2019-10-09  10771  out:
6716dfd581687f Omar Sandoval 2019-10-09  10772  	if (atomic_dec_return(&priv.pending))
6716dfd581687f Omar Sandoval 2019-10-09  10773  		io_wait_event(priv.wait, !atomic_read(&priv.pending));
6716dfd581687f Omar Sandoval 2019-10-09  10774  	/* See btrfs_encoded_read_endio() for ordering. */
6716dfd581687f Omar Sandoval 2019-10-09  10775  	return blk_status_to_errno(READ_ONCE(priv.status));
6716dfd581687f Omar Sandoval 2019-10-09  10776  }
6716dfd581687f Omar Sandoval 2019-10-09  10777  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 42315 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-19 13:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 13:42 [osandov:btrfs-send-encoded-v10 8/14] fs/btrfs/inode.c:10739:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.