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 
xfs-5.15-merge
head:   eabe005e2fe7a139233e5e0b7b125042a1b45c8f
commit: da3971f56e345e7a6ba1bc327084dfdebec1cad5 [23/25] xfs: grab active perag 
ref when reading AG headers
:::::: branch date: 15 hours ago
:::::: commit date: 15 hours ago
config: x86_64-randconfig-c001-20210805 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
41a6b50c25961addc04438b567ee1f4ef9e40f98)
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=da3971f56e345e7a6ba1bc327084dfdebec1cad5
        git remote add djwong-xfs 
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
        git fetch --no-tags djwong-xfs xfs-5.15-merge
        git checkout da3971f56e345e7a6ba1bc327084dfdebec1cad5
        # 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 <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
                           
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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/ntfs/dir.c:1222:6: note: Returning from 'IS_ERR'
           if (IS_ERR(bmp_vi)) {
               ^~~~~~~~~~~~~~
   fs/ntfs/dir.c:1222:2: note: Taking false branch
           if (IS_ERR(bmp_vi)) {
           ^
   fs/ntfs/dir.c:1230:15: note: Assuming the condition is false
           if (unlikely(bmp_pos >> 3 >= i_size_read(bmp_vi))) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   fs/ntfs/dir.c:1230:2: note: Taking false branch
           if (unlikely(bmp_pos >> 3 >= i_size_read(bmp_vi))) {
           ^
   fs/ntfs/dir.c:1239:2: note: Taking false branch
           ntfs_debug("Reading bitmap with page index 0x%llx, bit ofs 0x%llx",
           ^
   fs/ntfs/debug.h:39:2: note: expanded from macro 'ntfs_debug'
           if (0)                                                          \
           ^
   fs/ntfs/dir.c:1239:2: note: Loop condition is false.  Exiting loop
           ntfs_debug("Reading bitmap with page index 0x%llx, bit ofs 0x%llx",
           ^
   fs/ntfs/debug.h:37:35: note: expanded from macro 'ntfs_debug'
   #define ntfs_debug(fmt, ...)                                            \
                                                                           ^
   fs/ntfs/dir.c:1245:6: note: Calling 'IS_ERR'
           if (IS_ERR(bmp_page)) {
               ^~~~~~~~~~~~~~~~
   include/linux/err.h:36:2: note: Returning zero, which participates in a 
condition later
           return IS_ERR_VALUE((unsigned long)ptr);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs/dir.c:1245:6: note: Returning from 'IS_ERR'
           if (IS_ERR(bmp_page)) {
               ^~~~~~~~~~~~~~~~
   fs/ntfs/dir.c:1245:2: note: Taking false branch
           if (IS_ERR(bmp_page)) {
           ^
   fs/ntfs/dir.c:1253:2: note: Loop condition is false. Execution continues on 
line 1272
           while (!(bmp[cur_bmp_pos >> 3] & (1 << (cur_bmp_pos & 7)))) {
           ^
   fs/ntfs/dir.c:1272:2: note: Taking false branch
           ntfs_debug("Handling index buffer 0x%llx.",
           ^
   fs/ntfs/debug.h:39:2: note: expanded from macro 'ntfs_debug'
           if (0)                                                          \
           ^
   fs/ntfs/dir.c:1272:2: note: Loop condition is false.  Exiting loop
           ntfs_debug("Handling index buffer 0x%llx.",
           ^
   fs/ntfs/debug.h:37:35: note: expanded from macro 'ntfs_debug'
   #define ntfs_debug(fmt, ...)                                            \
                                                                           ^
   fs/ntfs/dir.c:1275:6: note: Assuming the condition is false
           if ((prev_ia_pos & (s64)PAGE_MASK) !=
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs/dir.c:1275:2: note: Taking false branch
           if ((prev_ia_pos & (s64)PAGE_MASK) !=
           ^
   fs/ntfs/dir.c:1297:2: note: Null pointer value stored to 'ia'
           ia = (INDEX_ALLOCATION*)(kaddr + (ia_pos & ~PAGE_MASK &
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs/dir.c:1300:15: note: 'ia' is >= 'kaddr'
           if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   fs/ntfs/dir.c:1300:15: note: Left side of '||' is false
           if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
                        ^
   fs/ntfs/dir.c:1300:2: note: Taking false branch
           if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
           ^
   fs/ntfs/dir.c:1306:36: note: Access to field 'magic' results in a 
dereference of a null pointer (loaded from variable 'ia')
           if (unlikely(!ntfs_is_indx_record(ia->magic))) {
                                             ^
   fs/ntfs/layout.h:139:50: note: expanded from macro 'ntfs_is_indx_record'
   #define ntfs_is_indx_record(x)          ( ntfs_is_magic (x, INDX) )
                                                            ^
   fs/ntfs/layout.h:124:45: note: expanded from macro 'ntfs_is_magic'
   #define ntfs_is_magic(x, m)     __ntfs_is_magic(x, magic_##m)
                                                   ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   Suppressed 6 warnings (6 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.
   Suppressed 6 warnings (6 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.
   7 warnings generated.
>> fs/xfs/scrub/bmap.c:617:2: warning: Undefined or garbage value returned to 
>> caller [clang-analyzer-core.uninitialized.UndefReturn]
           return error;
           ^
   fs/xfs/scrub/bmap.c:738:9: note: Calling 'xchk_bmap'
           return xchk_bmap(sc, XFS_ATTR_FORK);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/scrub/bmap.c:635:26: note: 'whichfork' is not equal to 0
           struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
                                          ^
   fs/xfs/libxfs/xfs_inode_fork.h:98:3: note: expanded from macro 
'XFS_IFORK_PTR'
           ((w) == XFS_DATA_FORK ? \
            ^~~
   fs/xfs/scrub/bmap.c:635:26: note: '?' condition is false
           struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
                                          ^
   fs/xfs/libxfs/xfs_inode_fork.h:98:3: note: expanded from macro 
'XFS_IFORK_PTR'
           ((w) == XFS_DATA_FORK ? \
            ^
   fs/xfs/scrub/bmap.c:635:26: note: 'whichfork' is equal to 1
           struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
                                          ^
   fs/xfs/libxfs/xfs_inode_fork.h:100:4: note: expanded from macro 
'XFS_IFORK_PTR'
                   ((w) == XFS_ATTR_FORK ? \
                    ^~~
   fs/xfs/scrub/bmap.c:635:26: note: '?' condition is true
           struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
                                          ^
   fs/xfs/libxfs/xfs_inode_fork.h:100:4: note: expanded from macro 
'XFS_IFORK_PTR'
                   ((w) == XFS_ATTR_FORK ? \
                    ^
   fs/xfs/scrub/bmap.c:641:6: note: Assuming 'ifp' is non-null
           if (!ifp)
               ^~~~
   fs/xfs/scrub/bmap.c:641:2: note: Taking false branch
           if (!ifp)
           ^
   fs/xfs/scrub/bmap.c:644:15: note: 'whichfork' is not equal to XFS_DATA_FORK
           info.is_rt = whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip);
                        ^~~~~~~~~
   fs/xfs/scrub/bmap.c:644:42: note: Left side of '&&' is false
           info.is_rt = whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip);
                                                   ^
   fs/xfs/scrub/bmap.c:646:19: note: 'whichfork' is not equal to XFS_DATA_FORK
           info.is_shared = whichfork == XFS_DATA_FORK && 
xfs_is_reflink_inode(ip);
                            ^~~~~~~~~
   fs/xfs/scrub/bmap.c:646:46: note: Left side of '&&' is false
           info.is_shared = whichfork == XFS_DATA_FORK && 
xfs_is_reflink_inode(ip);
                                                       ^
   fs/xfs/scrub/bmap.c:649:2: note: Control jumps to 'case 1:'  at line 657
           switch (whichfork) {
           ^
   fs/xfs/scrub/bmap.c:658:7: note: Assuming the condition is false
                   if (!xfs_sb_version_hasattr(&mp->m_sb) &&
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/scrub/bmap.c:658:42: note: Left side of '&&' is false
                   if (!xfs_sb_version_hasattr(&mp->m_sb) &&
                                                          ^
   fs/xfs/scrub/bmap.c:661:3: note:  Execution continues on line 668
                   break;
                   ^
   fs/xfs/scrub/bmap.c:668:2: note: Control jumps to 'case 
XFS_DINODE_FMT_EXTENTS:'  at line 674
           switch (ifp->if_format) {
           ^
   fs/xfs/scrub/bmap.c:675:3: note:  Execution continues on line 691
                   break;
                   ^
   fs/xfs/scrub/bmap.c:691:6: note: Assuming the condition is false
           if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/scrub/bmap.c:691:2: note: Taking false branch
           if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
           ^
   fs/xfs/scrub/bmap.c:696:6: note: Assuming the condition is false
           if (!xchk_fblock_process_error(sc, whichfork, 0, &error))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/scrub/bmap.c:696:2: note: Taking false branch
           if (!xchk_fblock_process_error(sc, whichfork, 0, &error))
           ^
   fs/xfs/scrub/bmap.c:701:8: note: 'whichfork' is not equal to 0
           ifp = XFS_IFORK_PTR(ip, whichfork);
                 ^
   fs/xfs/libxfs/xfs_inode_fork.h:98:3: note: expanded from macro 
'XFS_IFORK_PTR'
           ((w) == XFS_DATA_FORK ? \
            ^~~
   fs/xfs/scrub/bmap.c:701:8: note: '?' condition is false
           ifp = XFS_IFORK_PTR(ip, whichfork);
                 ^
   fs/xfs/libxfs/xfs_inode_fork.h:98:3: note: expanded from macro 
'XFS_IFORK_PTR'
           ((w) == XFS_DATA_FORK ? \
            ^
   fs/xfs/scrub/bmap.c:701:8: note: 'whichfork' is equal to 1
           ifp = XFS_IFORK_PTR(ip, whichfork);
                 ^
   fs/xfs/libxfs/xfs_inode_fork.h:100:4: note: expanded from macro 
'XFS_IFORK_PTR'
                   ((w) == XFS_ATTR_FORK ? \
                    ^~~
   fs/xfs/scrub/bmap.c:701:8: note: '?' condition is true
           ifp = XFS_IFORK_PTR(ip, whichfork);
                 ^
   fs/xfs/libxfs/xfs_inode_fork.h:100:4: note: expanded from macro 
'XFS_IFORK_PTR'
                   ((w) == XFS_ATTR_FORK ? \

vim +617 fs/xfs/scrub/bmap.c

5e777b62b0bcb6 Darrick J. Wong   2018-03-23  571  
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  572  /* Make sure each rmap has a 
corresponding bmbt entry. */
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  573  STATIC int
c517b3aa02cff1 Darrick J. Wong   2018-07-19  574  xchk_bmap_check_rmaps(
1d8a748a8aa94a Darrick J. Wong   2018-07-19  575        struct xfs_scrub        
*sc,
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  576        int                     
whichfork)
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  577  {
daf83964a3681c Christoph Hellwig 2020-05-18  578        struct xfs_ifork        
*ifp = XFS_IFORK_PTR(sc->ip, whichfork);
5fd68bdb5a87c9 Darrick J. Wong   2020-05-16  579        bool                    
zero_size;
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  580        int                     
error;
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  581  
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  582        if 
(!xfs_sb_version_hasrmapbt(&sc->mp->m_sb) ||
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  583            whichfork == 
XFS_COW_FORK ||
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  584            (sc->sm->sm_flags & 
XFS_SCRUB_OFLAG_CORRUPT))
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  585                return 0;
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  586  
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  587        /* Don't support 
realtime rmap checks yet. */
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  588        if 
(XFS_IS_REALTIME_INODE(sc->ip) && whichfork == XFS_DATA_FORK)
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  589                return 0;
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  590  
5fd68bdb5a87c9 Darrick J. Wong   2020-05-16  591        
ASSERT(XFS_IFORK_PTR(sc->ip, whichfork) != NULL);
5fd68bdb5a87c9 Darrick J. Wong   2020-05-16  592  
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  593        /*
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  594         * Only do this for 
complex maps that are in btree format, or for
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  595         * situations where we 
would seem to have a size but zero extents.
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  596         * The inode repair 
code can zap broken iforks, which means we have
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  597         * to flag this bmap as 
corrupt if there are rmaps that need to be
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  598         * reattached.
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  599         */
f7e67b20ecbbcb Christoph Hellwig 2020-05-18  600  
5fd68bdb5a87c9 Darrick J. Wong   2020-05-16  601        if (whichfork == 
XFS_DATA_FORK)
5fd68bdb5a87c9 Darrick J. Wong   2020-05-16  602                zero_size = 
i_size_read(VFS_I(sc->ip)) == 0;
5fd68bdb5a87c9 Darrick J. Wong   2020-05-16  603        else
5fd68bdb5a87c9 Darrick J. Wong   2020-05-16  604                zero_size = 
false;
5fd68bdb5a87c9 Darrick J. Wong   2020-05-16  605  
f7e67b20ecbbcb Christoph Hellwig 2020-05-18  606        if (ifp->if_format != 
XFS_DINODE_FMT_BTREE &&
daf83964a3681c Christoph Hellwig 2020-05-18  607            (zero_size || 
ifp->if_nextents > 0))
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  608                return 0;
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  609  
7354f20c8c6f61 Darrick J. Wong   2021-08-06  610        for_each_perag(sc->mp, 
iter) {
7354f20c8c6f61 Darrick J. Wong   2021-08-06  611                error = 
xchk_bmap_check_ag_rmaps(sc, whichfork, iter.pag);
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  612                if (error)
934933c3eec9e4 Dave Chinner      2021-06-02  613                        break;
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  614                if 
(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  615                        break;
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  616        }
934933c3eec9e4 Dave Chinner      2021-06-02 @617        return error;
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  618  }
5e777b62b0bcb6 Darrick J. Wong   2018-03-23  619  

:::::: The code at line 617 was first introduced by commit
:::::: 934933c3eec9e4a5826d3d7a47aca0742337fded xfs: convert raw ag walks to 
use for_each_perag

:::::: TO: Dave Chinner <[email protected]>
:::::: CC: Dave Chinner <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to