All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [osandov:btrfs-send-encoded 8/14] fs/btrfs/inode.c:10743:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
Date: Fri, 29 Oct 2021 06:11:19 +0800	[thread overview]
Message-ID: <202110290614.RhLynMka-lkp@intel.com> (raw)

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

CC: llvm(a)lists.linux.dev
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
head:   b460af84b8ddd4fd78e02fec6272b70326b87861
commit: d38f9ac9a40338488424fe7e8058dfb2542ca2ef [8/14] btrfs: add BTRFS_IOC_ENCODED_READ
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
config: x86_64-randconfig-c007-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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
        # https://github.com/osandov/linux/commit/d38f9ac9a40338488424fe7e8058dfb2542ca2ef
        git remote add osandov https://github.com/osandov/linux.git
        git fetch --no-tags osandov btrfs-send-encoded
        git checkout d38f9ac9a40338488424fe7e8058dfb2542ca2ef
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 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 >>)
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   9 warnings generated.
   fs/btrfs/disk-io.c:3328:3: warning: Value stored to 'features' is never read [clang-analyzer-deadcode.DeadStores]
                   features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
                   ^
   fs/btrfs/disk-io.c:3328:3: note: Value stored to 'features' is never read
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   8 warnings generated.
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   21 warnings generated.
   fs/btrfs/inode.c:5063:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                   ret = btrfs_readpage(NULL, page);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:5063:3: note: Value stored to 'ret' is never read
                   ret = btrfs_readpage(NULL, page);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:5981:20: warning: The left operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
           if (location.type == BTRFS_INODE_ITEM_KEY) {
                             ^
   fs/btrfs/inode.c:6047:24: note: Calling 'btrfs_lookup_dentry'
           struct inode *inode = btrfs_lookup_dentry(dir, dentry);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:5974:6: note: Assuming field 'len' is <= BTRFS_NAME_LEN
           if (dentry->d_name.len > BTRFS_NAME_LEN)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:5974:2: note: Taking false branch
           if (dentry->d_name.len > BTRFS_NAME_LEN)
           ^
   fs/btrfs/inode.c:5977:8: note: Calling 'btrfs_inode_by_name'
           ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:5684:6: note: Assuming 'path' is non-null
           if (!path)
               ^~~~~
   fs/btrfs/inode.c:5684:2: note: Taking false branch
           if (!path)
           ^
   fs/btrfs/inode.c:5689:2: note: Taking true branch
           if (IS_ERR_OR_NULL(di)) {
           ^
   fs/btrfs/inode.c:5690:9: note: 'di' is non-null
                   ret = di ? PTR_ERR(di) : -ENOENT;
                         ^~
   fs/btrfs/inode.c:5690:9: note: '?' condition is true
   fs/btrfs/inode.c:5691:3: note: Control jumps to line 5706
                   goto out;
                   ^
   fs/btrfs/inode.c:5707:2: note: Returning without writing to 'location->type'
           return ret;
           ^
   fs/btrfs/inode.c:5977:8: note: Returning from 'btrfs_inode_by_name'
           ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:5978:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   fs/btrfs/inode.c:5978:2: note: Taking false branch
           if (ret < 0)
           ^
   fs/btrfs/inode.c:5981:20: note: The left operand of '==' is a garbage value
           if (location.type == BTRFS_INODE_ITEM_KEY) {
               ~~~~~~~~~~~~~ ^
   fs/btrfs/inode.c:7226:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = 0;
           ^     ~
   fs/btrfs/inode.c:7226:2: note: Value stored to 'ret' is never read
           ret = 0;
           ^     ~
   fs/btrfs/inode.c:7804:12: warning: Although the value stored to 'em' is used in the enclosing expression, the value is never actually read from 'em' [clang-analyzer-deadcode.DeadStores]
                                   *map = em = em2;
                                          ^    ~~~
   fs/btrfs/inode.c:7804:12: note: Although the value stored to 'em' is used in the enclosing expression, the value is never actually read from 'em'
                                   *map = em = em2;
                                          ^    ~~~
   fs/btrfs/inode.c:9542:4: warning: Value stored to 'root_log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
                           root_log_pinned = false;
                           ^                 ~~~~~
   fs/btrfs/inode.c:9542:4: note: Value stored to 'root_log_pinned' is never read
                           root_log_pinned = false;
                           ^                 ~~~~~
   fs/btrfs/inode.c:9546:4: warning: Value stored to 'dest_log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
                           dest_log_pinned = false;
                           ^                 ~~~~~
   fs/btrfs/inode.c:9546:4: note: Value stored to 'dest_log_pinned' is never read
                           dest_log_pinned = false;
                           ^                 ~~~~~
   fs/btrfs/inode.c:9662:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = 0;
           ^     ~
   fs/btrfs/inode.c:9662:2: note: Value stored to 'ret' is never read
           ret = 0;
           ^     ~
   fs/btrfs/inode.c:9833:3: warning: Value stored to 'log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
                   log_pinned = false;
                   ^            ~~~~~
   fs/btrfs/inode.c:9833:3: note: Value stored to 'log_pinned' is never read
                   log_pinned = false;
                   ^            ~~~~~
>> fs/btrfs/inode.c:10743: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:10867:6: note: Assuming field 'ki_pos' is < field 'i_size'
           if (iocb->ki_pos >= inode->i_size) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10867:2: note: Taking false branch
           if (iocb->ki_pos >= inode->i_size) {
           ^
   fs/btrfs/inode.c:10878:2: note: Loop condition is true.  Entering loop body
           for (;;) {
           ^
   fs/btrfs/inode.c:10883:7: note: Assuming 'ret' is 0
                   if (ret)
                       ^~~
   fs/btrfs/inode.c:10883:3: note: Taking false branch
                   if (ret)
                   ^
   fs/btrfs/inode.c:10888:7: note: Assuming 'ordered' is null
                   if (!ordered)
                       ^~~~~~~~
   fs/btrfs/inode.c:10888:3: note: Taking true branch
                   if (!ordered)
                   ^
   fs/btrfs/inode.c:10889:4: note:  Execution continues on line 10895
                           break;
                           ^
   fs/btrfs/inode.c:10897:2: note: Taking false branch
           if (IS_ERR(em)) {
           ^
   fs/btrfs/inode.c:10902:6: note: Assuming the condition is false
           if (em->block_start == EXTENT_MAP_INLINE) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10902:2: note: Taking false branch
           if (em->block_start == EXTENT_MAP_INLINE) {
           ^
   fs/btrfs/inode.c:10921:18: note: '__UNIQUE_ID___x2405' is >= '__UNIQUE_ID___y2406'
           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:10921: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:10923:6: note: Assuming the condition is false
           if (em->block_start == EXTENT_MAP_HOLE ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10923:6: note: Left side of '||' is false
   fs/btrfs/inode.c:10924:6: note: Assuming the condition is false
               test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10923:2: note: Taking false branch
           if (em->block_start == EXTENT_MAP_HOLE ||
           ^
   fs/btrfs/inode.c:10928:13: note: Assuming the condition is true
           } else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10928:9: note: Taking true branch
           } else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
                  ^
   fs/btrfs/inode.c:10934:7: note: Assuming 'count' is >= field 'block_len'
                   if (em->block_len > count) {
                       ^~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/inode.c:10934:3: note: Taking false branch
                   if (em->block_len > count) {
                   ^
   fs/btrfs/inode.c:10943:7: note: 'ret' is >= 0
                   if (ret < 0)
                       ^~~
   fs/btrfs/inode.c:10943:3: note: Taking false branch

vim +10743 fs/btrfs/inode.c

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

---
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: 39328 bytes --]

             reply	other threads:[~2021-10-28 22:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 22:11 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-28 13:14 [osandov:btrfs-send-encoded 8/14] fs/btrfs/inode.c:10743:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202110290614.RhLynMka-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.