CC: [email protected] CC: [email protected] CC: "Darrick J. Wong" <[email protected]> CC: [email protected] TO: "Darrick J. Wong" <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git log-recovery-defer-capture head: a9ba97129f384fff0a4ac1ff3e2c4b455ea77c88 commit: ebbf385a912f3d1e5c13d7e33101e8aefb300f15 [45/87] xfs: repair inode block maps :::::: branch date: 5 weeks ago :::::: commit date: 5 weeks ago config: arm-randconfig-c002-20211031 (https://download.01.org/0day-ci/archive/20211126/[email protected]/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d321548c3ce987f4f21350ba1c81fdb5d4354224) 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 arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=ebbf385a912f3d1e5c13d7e33101e8aefb300f15 git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git git fetch --no-tags djwong-xfs log-recovery-defer-capture git checkout ebbf385a912f3d1e5c13d7e33101e8aefb300f15 # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^ drivers/media/tuners/xc5000.c:37:2: note: expanded from macro 'dprintk' printk(KERN_INFO "%s: " fmt, "xc5000", ## arg) ^ include/linux/printk.h:446:26: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^ include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap' __printk_index_emit(_fmt, NULL, NULL); \ ^ include/linux/printk.h:392:34: note: expanded from macro '__printk_index_emit' #define __printk_index_emit(...) do {} while (0) ^ drivers/media/tuners/xc5000.c:674:54: note: The left operand of '/' is a garbage value dprintk(1, "*** Total gain = %d.%d dB\n", totalgain / 256, ^ drivers/media/tuners/xc5000.c:37:44: note: expanded from macro 'dprintk' printk(KERN_INFO "%s: " fmt, "xc5000", ## arg) ^~~ include/linux/printk.h:446:60: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/printk.h:418:19: note: expanded from macro 'printk_index_wrap' _p_func(_fmt, ##__VA_ARGS__); \ ^~~~~~~~~~~ Suppressed 17 warnings (17 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 17 warnings generated. Suppressed 17 warnings (17 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. 17 warnings generated. Suppressed 17 warnings (17 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. drivers/mtd/devices/phram.c:231:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(str, val); ^~~~~~ drivers/mtd/devices/phram.c:231:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(str, val); ^~~~~~ drivers/mtd/devices/phram.c:315:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(phram_paramline, val); ^~~~~~ drivers/mtd/devices/phram.c:315:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(phram_paramline, val); ^~~~~~ Suppressed 2 warnings (2 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. 18 warnings generated. drivers/mtd/devices/block2mtd.c:395:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(str, val); ^~~~~~ drivers/mtd/devices/block2mtd.c:395:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(str, val); ^~~~~~ Suppressed 17 warnings (17 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. 20 warnings generated. fs/xfs/libxfs/xfs_attr_leaf.c:2253: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:2253: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:2254: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:2254: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 18 warnings (18 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. 18 warnings generated. Suppressed 18 warnings (18 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. 17 warnings generated. Suppressed 17 warnings (17 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/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 19 warnings (18 in non-user code, 1 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 20 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:214: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:214: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:214: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:214: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:214: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:214: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:214: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 ebbf385a912f3d Darrick J. Wong 2021-09-01 613 ebbf385a912f3d Darrick J. Wong 2021-09-01 614 /* ebbf385a912f3d Darrick J. Wong 2021-09-01 615 * Swap in the new inode fork root. Once we pass this point the newly rebuilt ebbf385a912f3d Darrick J. Wong 2021-09-01 616 * mappings are in place and we have to kill off any old btree blocks. ebbf385a912f3d Darrick J. Wong 2021-09-01 617 */ ebbf385a912f3d Darrick J. Wong 2021-09-01 618 void ebbf385a912f3d Darrick J. Wong 2021-09-01 619 xfs_bmbt_commit_staged_btree( ebbf385a912f3d Darrick J. Wong 2021-09-01 620 struct xfs_btree_cur *cur, ebbf385a912f3d Darrick J. Wong 2021-09-01 621 struct xfs_trans *tp, ebbf385a912f3d Darrick J. Wong 2021-09-01 622 int whichfork) ebbf385a912f3d Darrick J. Wong 2021-09-01 623 { ebbf385a912f3d Darrick J. Wong 2021-09-01 624 struct xbtree_ifakeroot *ifake = cur->bc_ino.ifake; ebbf385a912f3d Darrick J. Wong 2021-09-01 625 struct xfs_ifork *ifp; ebbf385a912f3d Darrick J. Wong 2021-09-01 626 static const short brootflag[2] = ebbf385a912f3d Darrick J. Wong 2021-09-01 627 { XFS_ILOG_DBROOT, XFS_ILOG_ABROOT }; ebbf385a912f3d Darrick J. Wong 2021-09-01 628 static const short extflag[2] = ebbf385a912f3d Darrick J. Wong 2021-09-01 629 { XFS_ILOG_DEXT, XFS_ILOG_AEXT }; ebbf385a912f3d Darrick J. Wong 2021-09-01 630 int flags = XFS_ILOG_CORE; ebbf385a912f3d Darrick J. Wong 2021-09-01 631 ebbf385a912f3d Darrick J. Wong 2021-09-01 632 ASSERT(cur->bc_flags & XFS_BTREE_STAGING); ebbf385a912f3d Darrick J. Wong 2021-09-01 633 ASSERT(whichfork != XFS_COW_FORK); ebbf385a912f3d Darrick J. Wong 2021-09-01 634 ebbf385a912f3d Darrick J. Wong 2021-09-01 635 /* ebbf385a912f3d Darrick J. Wong 2021-09-01 636 * Free any resources hanging off the real fork, then shallow-copy the ebbf385a912f3d Darrick J. Wong 2021-09-01 637 * staging fork's contents into the real fork to transfer everything ebbf385a912f3d Darrick J. Wong 2021-09-01 638 * we just built. ebbf385a912f3d Darrick J. Wong 2021-09-01 639 */ ebbf385a912f3d Darrick J. Wong 2021-09-01 640 ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork); ebbf385a912f3d Darrick J. Wong 2021-09-01 641 xfs_idestroy_fork(ifp); ebbf385a912f3d Darrick J. Wong 2021-09-01 642 memcpy(ifp, ifake->if_fork, sizeof(struct xfs_ifork)); ebbf385a912f3d Darrick J. Wong 2021-09-01 643 ebbf385a912f3d Darrick J. Wong 2021-09-01 644 switch (ifp->if_format) { ebbf385a912f3d Darrick J. Wong 2021-09-01 645 case XFS_DINODE_FMT_EXTENTS: ebbf385a912f3d Darrick J. Wong 2021-09-01 @646 flags |= extflag[whichfork]; ebbf385a912f3d Darrick J. Wong 2021-09-01 647 break; ebbf385a912f3d Darrick J. Wong 2021-09-01 648 case XFS_DINODE_FMT_BTREE: ebbf385a912f3d Darrick J. Wong 2021-09-01 649 flags |= brootflag[whichfork]; ebbf385a912f3d Darrick J. Wong 2021-09-01 650 break; ebbf385a912f3d Darrick J. Wong 2021-09-01 651 default: ebbf385a912f3d Darrick J. Wong 2021-09-01 652 ASSERT(0); ebbf385a912f3d Darrick J. Wong 2021-09-01 653 break; ebbf385a912f3d Darrick J. Wong 2021-09-01 654 } ebbf385a912f3d Darrick J. Wong 2021-09-01 655 xfs_trans_log_inode(tp, cur->bc_ino.ip, flags); ebbf385a912f3d Darrick J. Wong 2021-09-01 656 xfs_btree_commit_ifakeroot(cur, tp, whichfork, &xfs_bmbt_ops); ebbf385a912f3d Darrick J. Wong 2021-09-01 657 } ebbf385a912f3d Darrick J. Wong 2021-09-01 658 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
