All of lore.kernel.org
 help / color / mirror / Atom feed
* [djwong-xfs:vectorized-scrub 71/306] fs/xfs/libxfs/xfs_bmap_btree.c:646:9: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-07-28  1:49 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-07-28  1:49 UTC (permalink / raw)
  To: kbuild

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

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong@oracle.com>
CC: linux-kernel(a)vger.kernel.org
TO: "Darrick J. Wong" <djwong@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git vectorized-scrub
head:   653d694bd02b6f3aa956b6efe9476a7b948faa96
commit: d3c651c31aab150baf49475b2f2fc87eb852c229 [71/306] xfs: repair inode block maps
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: x86_64-randconfig-c001-20210723 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 3f2c1e99e44d028d5e9dd685f3c568f2661f2f68)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=d3c651c31aab150baf49475b2f2fc87eb852c229
        git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
        git fetch --no-tags djwong-xfs vectorized-scrub
        git checkout d3c651c31aab150baf49475b2f2fc87eb852c229
        # 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 >>)
           ^
   fs/xfs/xfs_fsmap.c:615:2: note: Assuming 'pag' is not equal to null
           for_each_perag_range(mp, start_ag, end_ag, pag) {
           ^
   fs/xfs/libxfs/xfs_ag.h:140:3: note: expanded from macro 'for_each_perag_range'
                   (pag) != NULL && (next_agno) <= (end_agno); \
                   ^~~~~~~~~~~~~
   fs/xfs/xfs_fsmap.c:615:2: note: Left side of '&&' is true
           for_each_perag_range(mp, start_ag, end_ag, pag) {
           ^
   fs/xfs/libxfs/xfs_ag.h:140:3: note: expanded from macro 'for_each_perag_range'
                   (pag) != NULL && (next_agno) <= (end_agno); \
                   ^
   fs/xfs/xfs_fsmap.c:615:2: note: Assuming 'start_ag' is <= 'end_ag'
           for_each_perag_range(mp, start_ag, end_ag, pag) {
           ^
   fs/xfs/libxfs/xfs_ag.h:140:20: note: expanded from macro 'for_each_perag_range'
                   (pag) != NULL && (next_agno) <= (end_agno); \
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_fsmap.c:615:2: note: Loop condition is true.  Entering loop body
           for_each_perag_range(mp, start_ag, end_ag, pag) {
           ^
   fs/xfs/libxfs/xfs_ag.h:139:2: note: expanded from macro 'for_each_perag_range'
           for ((pag) = xfs_perag_get((mp), (next_agno)); \
           ^
   fs/xfs/xfs_fsmap.c:621:7: note: Assuming 'end_ag' is not equal to field 'pag_agno'
                   if (pag->pag_agno == end_ag) {
                       ^~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_fsmap.c:621:3: note: Taking false branch
                   if (pag->pag_agno == end_ag) {
                   ^
   fs/xfs/xfs_fsmap.c:632:7: note: 'bt_cur' is null
                   if (bt_cur) {
                       ^~~~~~
   fs/xfs/xfs_fsmap.c:632:3: note: Taking false branch
                   if (bt_cur) {
                   ^
   fs/xfs/xfs_fsmap.c:641:7: note: Assuming 'error' is 0
                   if (error)
                       ^~~~~
   fs/xfs/xfs_fsmap.c:641:3: note: Taking false branch
                   if (error)
                   ^
   fs/xfs/xfs_fsmap.c:649:11: note: Calling 'xfs_getfsmap_datadev_bnobt_query'
                   error = query_fn(tp, info, &bt_cur, priv);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_fsmap.c:738:6: note: Assuming field 'last' is true
           if (info->last)
               ^~~~~~~~~~
   fs/xfs/xfs_fsmap.c:738:2: note: Taking true branch
           if (info->last)
           ^
   fs/xfs/xfs_fsmap.c:739:44: note: Passing null pointer value via 1st parameter 'cur'
                   return xfs_getfsmap_datadev_bnobt_helper(*curpp, &key[1], info);
                                                            ^~~~~~
   fs/xfs/xfs_fsmap.c:739:10: note: Calling 'xfs_getfsmap_datadev_bnobt_helper'
                   return xfs_getfsmap_datadev_bnobt_helper(*curpp, &key[1], info);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_fsmap.c:371:26: note: Access to field 'bc_mp' results in a dereference of a null pointer (loaded from variable 'cur')
           struct xfs_mount                *mp = cur->bc_mp;
                                                 ^~~
   Suppressed 4 warnings (4 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.
   6 warnings generated.
   fs/xfs/libxfs/xfs_attr_leaf.c:2248:29: warning: Value stored to 'drop_leaf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct xfs_attr_leafblock *drop_leaf = drop_blk->bp->b_addr;
                                      ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_attr_leaf.c:2248:29: note: Value stored to 'drop_leaf' during its initialization is never read
           struct xfs_attr_leafblock *drop_leaf = drop_blk->bp->b_addr;
                                      ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_attr_leaf.c:2249:29: warning: Value stored to 'save_leaf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct xfs_attr_leafblock *save_leaf = save_blk->bp->b_addr;
                                      ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_attr_leaf.c:2249:29: note: Value stored to 'save_leaf' during its initialization is never read
           struct xfs_attr_leafblock *save_leaf = save_blk->bp->b_addr;
                                      ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   6 warnings generated.
   fs/xfs/libxfs/xfs_bmap.c:850:2: warning: Value stored to 'error' is never read [clang-analyzer-deadcode.DeadStores]
           error = 0;
           ^       ~
   fs/xfs/libxfs/xfs_bmap.c:850:2: note: Value stored to 'error' is never read
           error = 0;
           ^       ~
   fs/xfs/libxfs/xfs_bmap.c:5082:2: warning: Value stored to 'qfield' is never read [clang-analyzer-deadcode.DeadStores]
           qfield = 0;
           ^        ~
   fs/xfs/libxfs/xfs_bmap.c:5082:2: note: Value stored to 'qfield' is never read
           qfield = 0;
           ^        ~
   Suppressed 4 warnings (4 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.
   6 warnings generated.
>> fs/xfs/libxfs/xfs_bmap_btree.c:646:9: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   flags |= extflag[whichfork];
                         ^  ~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_bmap_btree.c:632:2: note: Assuming the condition is false
           ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
           ^
   fs/xfs/xfs_linux.h:215:3: note: expanded from macro 'ASSERT'
           (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
            ^~~~~~~~~~~~
   include/linux/compiler.h:77:38: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                                             ^~~~
   fs/xfs/libxfs/xfs_bmap_btree.c:632:2: note: '?' condition is true
           ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
           ^
   fs/xfs/xfs_linux.h:215:3: note: expanded from macro 'ASSERT'
           (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
            ^
   include/linux/compiler.h:77:20: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                           ^
   fs/xfs/libxfs/xfs_bmap_btree.c:633:9: note: Assuming 'whichfork' is equal to 2
           ASSERT(whichfork != XFS_COW_FORK);
                  ^
   fs/xfs/xfs_linux.h:215:10: note: expanded from macro 'ASSERT'
           (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
            ~~~~~~~^~~~~
   include/linux/compiler.h:77:40: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                                               ^
   fs/xfs/libxfs/xfs_bmap_btree.c:633:2: note: '?' condition is false
           ASSERT(whichfork != XFS_COW_FORK);
           ^
   fs/xfs/xfs_linux.h:215:3: note: expanded from macro 'ASSERT'
           (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
            ^
   include/linux/compiler.h:77:20: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                           ^
   fs/xfs/libxfs/xfs_bmap_btree.c:640:8: note: 'whichfork' is not equal to 0
           ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
                 ^
   fs/xfs/libxfs/xfs_inode_fork.h:98:3: note: expanded from macro 'XFS_IFORK_PTR'
           ((w) == XFS_DATA_FORK ? \
            ^~~
   fs/xfs/libxfs/xfs_bmap_btree.c:640:8: note: '?' condition is false
           ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
                 ^
   fs/xfs/libxfs/xfs_inode_fork.h:98:3: note: expanded from macro 'XFS_IFORK_PTR'
           ((w) == XFS_DATA_FORK ? \
            ^
   fs/xfs/libxfs/xfs_bmap_btree.c:640:8: note: 'whichfork' is not equal to 1
           ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
                 ^
   fs/xfs/libxfs/xfs_inode_fork.h:100:4: note: expanded from macro 'XFS_IFORK_PTR'
                   ((w) == XFS_ATTR_FORK ? \
                    ^~~
   fs/xfs/libxfs/xfs_bmap_btree.c:640:8: note: '?' condition is false
           ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
                 ^
   fs/xfs/libxfs/xfs_inode_fork.h:100:4: note: expanded from macro 'XFS_IFORK_PTR'
                   ((w) == XFS_ATTR_FORK ? \
                    ^
   fs/xfs/libxfs/xfs_bmap_btree.c:644:2: note: Control jumps to 'case XFS_DINODE_FMT_EXTENTS:'  at line 645
           switch (ifp->if_format) {
           ^
   fs/xfs/libxfs/xfs_bmap_btree.c:646:9: note: Assigned value is garbage or undefined
                   flags |= extflag[whichfork];
                         ^  ~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_bmap_btree.c:649:9: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   flags |= brootflag[whichfork];
                         ^  ~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_bmap_btree.c:632:2: note: Assuming the condition is false
           ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
           ^
   fs/xfs/xfs_linux.h:215:3: note: expanded from macro 'ASSERT'
           (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
            ^~~~~~~~~~~~
   include/linux/compiler.h:77:38: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                                             ^~~~
   fs/xfs/libxfs/xfs_bmap_btree.c:632:2: note: '?' condition is true
           ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
           ^
   fs/xfs/xfs_linux.h:215:3: note: expanded from macro 'ASSERT'
           (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
            ^
   include/linux/compiler.h:77:20: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                           ^
   fs/xfs/libxfs/xfs_bmap_btree.c:633:9: note: Assuming 'whichfork' is equal to 2
           ASSERT(whichfork != XFS_COW_FORK);
                  ^
   fs/xfs/xfs_linux.h:215:10: note: expanded from macro 'ASSERT'
           (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
            ~~~~~~~^~~~~
   include/linux/compiler.h:77:40: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                                               ^
   fs/xfs/libxfs/xfs_bmap_btree.c:633:2: note: '?' condition is false
           ASSERT(whichfork != XFS_COW_FORK);

vim +646 fs/xfs/libxfs/xfs_bmap_btree.c

d3c651c31aab15 Darrick J. Wong 2021-01-05  613  
d3c651c31aab15 Darrick J. Wong 2021-01-05  614  /*
d3c651c31aab15 Darrick J. Wong 2021-01-05  615   * Swap in the new inode fork root.  Once we pass this point the newly rebuilt
d3c651c31aab15 Darrick J. Wong 2021-01-05  616   * mappings are in place and we have to kill off any old btree blocks.
d3c651c31aab15 Darrick J. Wong 2021-01-05  617   */
d3c651c31aab15 Darrick J. Wong 2021-01-05  618  void
d3c651c31aab15 Darrick J. Wong 2021-01-05  619  xfs_bmbt_commit_staged_btree(
d3c651c31aab15 Darrick J. Wong 2021-01-05  620  	struct xfs_btree_cur	*cur,
d3c651c31aab15 Darrick J. Wong 2021-01-05  621  	struct xfs_trans	*tp,
d3c651c31aab15 Darrick J. Wong 2021-01-05  622  	int			whichfork)
d3c651c31aab15 Darrick J. Wong 2021-01-05  623  {
d3c651c31aab15 Darrick J. Wong 2021-01-05  624  	struct xbtree_ifakeroot	*ifake = cur->bc_ino.ifake;
d3c651c31aab15 Darrick J. Wong 2021-01-05  625  	struct xfs_ifork	*ifp;
d3c651c31aab15 Darrick J. Wong 2021-01-05  626  	static const short	brootflag[2] =
d3c651c31aab15 Darrick J. Wong 2021-01-05  627  		{ XFS_ILOG_DBROOT, XFS_ILOG_ABROOT };
d3c651c31aab15 Darrick J. Wong 2021-01-05  628  	static const short	extflag[2] =
d3c651c31aab15 Darrick J. Wong 2021-01-05  629  		{ XFS_ILOG_DEXT, XFS_ILOG_AEXT };
d3c651c31aab15 Darrick J. Wong 2021-01-05  630  	int			flags = XFS_ILOG_CORE;
d3c651c31aab15 Darrick J. Wong 2021-01-05  631  
d3c651c31aab15 Darrick J. Wong 2021-01-05  632  	ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
d3c651c31aab15 Darrick J. Wong 2021-01-05  633  	ASSERT(whichfork != XFS_COW_FORK);
d3c651c31aab15 Darrick J. Wong 2021-01-05  634  
d3c651c31aab15 Darrick J. Wong 2021-01-05  635  	/*
d3c651c31aab15 Darrick J. Wong 2021-01-05  636  	 * Free any resources hanging off the real fork, then shallow-copy the
d3c651c31aab15 Darrick J. Wong 2021-01-05  637  	 * staging fork's contents into the real fork to transfer everything
d3c651c31aab15 Darrick J. Wong 2021-01-05  638  	 * we just built.
d3c651c31aab15 Darrick J. Wong 2021-01-05  639  	 */
d3c651c31aab15 Darrick J. Wong 2021-01-05  640  	ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
d3c651c31aab15 Darrick J. Wong 2021-01-05  641  	xfs_idestroy_fork(ifp);
d3c651c31aab15 Darrick J. Wong 2021-01-05  642  	memcpy(ifp, ifake->if_fork, sizeof(struct xfs_ifork));
d3c651c31aab15 Darrick J. Wong 2021-01-05  643  
d3c651c31aab15 Darrick J. Wong 2021-01-05  644  	switch (ifp->if_format) {
d3c651c31aab15 Darrick J. Wong 2021-01-05  645  	case XFS_DINODE_FMT_EXTENTS:
d3c651c31aab15 Darrick J. Wong 2021-01-05 @646  		flags |= extflag[whichfork];
d3c651c31aab15 Darrick J. Wong 2021-01-05  647  		break;
d3c651c31aab15 Darrick J. Wong 2021-01-05  648  	case XFS_DINODE_FMT_BTREE:
d3c651c31aab15 Darrick J. Wong 2021-01-05  649  		flags |= brootflag[whichfork];
d3c651c31aab15 Darrick J. Wong 2021-01-05  650  		break;
d3c651c31aab15 Darrick J. Wong 2021-01-05  651  	default:
d3c651c31aab15 Darrick J. Wong 2021-01-05  652  		ASSERT(0);
d3c651c31aab15 Darrick J. Wong 2021-01-05  653  		break;
d3c651c31aab15 Darrick J. Wong 2021-01-05  654  	}
d3c651c31aab15 Darrick J. Wong 2021-01-05  655  	xfs_trans_log_inode(tp, cur->bc_ino.ip, flags);
d3c651c31aab15 Darrick J. Wong 2021-01-05  656  	xfs_btree_commit_ifakeroot(cur, tp, whichfork, &xfs_bmbt_ops);
d3c651c31aab15 Darrick J. Wong 2021-01-05  657  }
d3c651c31aab15 Darrick J. Wong 2021-01-05  658  

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

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

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

only message in thread, other threads:[~2021-07-28  1:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28  1:49 [djwong-xfs:vectorized-scrub 71/306] fs/xfs/libxfs/xfs_bmap_btree.c:646:9: 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.