CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Dave Chinner <[email protected]>
CC: "Darrick J. Wong" <[email protected]>
CC: Christoph Hellwig <[email protected]>

tree:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git xfs-5.15-merge
head:   61e0d0cc51cd6b9d7447923f3ac7e60049de3e2e
commit: 04fcad80cd068731a779fb442f78234732683755 [98/101] xfs: introduce 
xfs_buf_daddr()
:::::: branch date: 2 days ago
:::::: commit date: 3 days ago
config: riscv-randconfig-c006-20210821 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
a83d99c55ebb14532c414066a5aa3bdb65389965)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # 
https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git/commit/?id=04fcad80cd068731a779fb442f78234732683755
        git remote add xfs-linux 
https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
        git fetch --no-tags xfs-linux xfs-5.15-merge
        git checkout 04fcad80cd068731a779fb442f78234732683755
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 
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 >>)
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro 
'__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   fs/xfs/libxfs/xfs_btree.c:1817:2: note: Loop condition is false.  Exiting 
loop
           XFS_BTREE_STATS_INC(cur, lookup);
           ^
   fs/xfs/libxfs/xfs_btree.h:91:2: note: expanded from macro 
'XFS_BTREE_STATS_INC'
           XFS_STATS_INC_OFF((cur)->bc_mp, (cur)->bc_statoff + __XBTS_ ## stat)
           ^
   fs/xfs/xfs_stats.h:184:2: note: expanded from macro 'XFS_STATS_INC_OFF'
           per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->a[off]++;     \
           ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 
'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro 
'__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   fs/xfs/libxfs/xfs_btree.c:1817:2: note: Loop condition is false.  Exiting 
loop
           XFS_BTREE_STATS_INC(cur, lookup);
           ^
   fs/xfs/libxfs/xfs_btree.h:91:2: note: expanded from macro 
'XFS_BTREE_STATS_INC'
           XFS_STATS_INC_OFF((cur)->bc_mp, (cur)->bc_statoff + __XBTS_ ## stat)
           ^
   fs/xfs/xfs_stats.h:181:39: note: expanded from macro 'XFS_STATS_INC_OFF'
   #define XFS_STATS_INC_OFF(mp, off)                              \
                                                                   ^
   fs/xfs/libxfs/xfs_btree.c:1820:33: note: Assuming field 'bc_nlevels' is not 
equal to 0
           if (XFS_IS_CORRUPT(cur->bc_mp, cur->bc_nlevels == 0))
                                          ^
   fs/xfs/xfs_linux.h:224:12: note: expanded from macro 'XFS_IS_CORRUPT'
           (unlikely(expr) ? xfs_corruption_error(#expr, XFS_ERRLEVEL_LOW, 
(mp), \
                     ^~~~
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   fs/xfs/libxfs/xfs_btree.c:1820:6: note: '?' condition is false
           if (XFS_IS_CORRUPT(cur->bc_mp, cur->bc_nlevels == 0))
               ^
   fs/xfs/xfs_linux.h:224:3: note: expanded from macro 'XFS_IS_CORRUPT'
           (unlikely(expr) ? xfs_corruption_error(#expr, XFS_ERRLEVEL_LOW, 
(mp), \
            ^
   include/linux/compiler.h:78:22: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                           ^
   fs/xfs/libxfs/xfs_btree.c:1820:2: note: Taking false branch
           if (XFS_IS_CORRUPT(cur->bc_mp, cur->bc_nlevels == 0))
           ^
   fs/xfs/libxfs/xfs_btree.c:1823:2: note: Null pointer value stored to 'block'
           block = NULL;
           ^~~~~~~~~~~~
   fs/xfs/libxfs/xfs_btree.c:1836:46: note: Assuming 'level' is < 0
           for (level = cur->bc_nlevels - 1, diff = 1; level >= 0; level--) {
                                                       ^~~~~~~~~~
   fs/xfs/libxfs/xfs_btree.c:1836:2: note: Loop condition is false. Execution 
continues on line 1924
           for (level = cur->bc_nlevels - 1, diff = 1; level >= 0; level--) {
           ^
   fs/xfs/libxfs/xfs_btree.c:1924:6: note: 'dir' is equal to XFS_LOOKUP_LEi
           if (dir != XFS_LOOKUP_LE && diff < 0) {
               ^~~
   fs/xfs/libxfs/xfs_btree.c:1924:27: note: Left side of '&&' is false
           if (dir != XFS_LOOKUP_LE && diff < 0) {
                                    ^
   fs/xfs/libxfs/xfs_btree.c:1945:13: note: 'dir' is equal to XFS_LOOKUP_LEi
           } else if (dir == XFS_LOOKUP_LE && diff > 0)
                      ^~~
   fs/xfs/libxfs/xfs_btree.c:1945:13: note: Left side of '&&' is true
   fs/xfs/libxfs/xfs_btree.c:1945:37: note: 'diff' is > 0
           } else if (dir == XFS_LOOKUP_LE && diff > 0)
                                              ^~~~
   fs/xfs/libxfs/xfs_btree.c:1945:9: note: Taking true branch
           } else if (dir == XFS_LOOKUP_LE && diff > 0)
                  ^
   fs/xfs/libxfs/xfs_btree.c:1950:6: note: 'keyno' is not equal to 0
           if (keyno == 0 || keyno > xfs_btree_get_numrecs(block))
               ^~~~~
   fs/xfs/libxfs/xfs_btree.c:1950:6: note: Left side of '||' is false
   fs/xfs/libxfs/xfs_btree.c:1950:50: note: Passing null pointer value via 1st 
parameter 'block'
           if (keyno == 0 || keyno > xfs_btree_get_numrecs(block))
                                                           ^~~~~
   fs/xfs/libxfs/xfs_btree.c:1950:28: note: Calling 'xfs_btree_get_numrecs'
           if (keyno == 0 || keyno > xfs_btree_get_numrecs(block))
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_btree.h:428:9: note: Access to field 'bb_numrecs' results 
in a dereference of a null pointer (loaded from variable 'block')
           return be16_to_cpu(block->bb_numrecs);
                  ^
   include/linux/byteorder/generic.h:97:21: note: expanded from macro 
'be16_to_cpu'
   #define be16_to_cpu __be16_to_cpu
                       ^
   include/uapi/linux/byteorder/little_endian.h:42:58: note: expanded from 
macro '__be16_to_cpu'
   #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
                                                            ^~
   include/uapi/linux/swab.h:105:32: note: expanded from macro '__swab16'
           (__builtin_constant_p((__u16)(x)) ?     \
                                         ^
>> fs/xfs/xfs_buf.h:318:9: warning: Access to field 'b_maps' results in a 
>> dereference of a null pointer (loaded from variable 'bp') 
>> [clang-analyzer-core.NullDereference]
           return bp->b_maps[0].bm_bn;
                  ^
   fs/xfs/libxfs/xfs_btree.c:3421:11: note: Calling 'xfs_btree_insrec'
                   error = xfs_btree_insrec(pcur, level, &nptr, &rec, key,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_btree.c:3207:6: note: Assuming the condition is true
           if (!(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_btree.c:3207:6: note: Left side of '&&' is true
   fs/xfs/libxfs/xfs_btree.c:3208:7: note: Assuming 'level' is >= field 
'bc_nlevels'
               (level >= cur->bc_nlevels)) {
                ^~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_btree.c:3207:2: note: Taking true branch
           if (!(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
           ^
   fs/xfs/libxfs/xfs_btree.c:3209:11: note: Calling 'xfs_btree_new_root'
                   error = xfs_btree_new_root(cur, stat);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_btree.c:2999:2: note: Loop condition is false.  Exiting 
loop
           XFS_BTREE_STATS_INC(cur, newroot);
           ^
   fs/xfs/libxfs/xfs_btree.h:91:2: note: expanded from macro 
'XFS_BTREE_STATS_INC'
           XFS_STATS_INC_OFF((cur)->bc_mp, (cur)->bc_statoff + __XBTS_ ## stat)
           ^
   fs/xfs/xfs_stats.h:183:2: note: expanded from macro 'XFS_STATS_INC_OFF'
           per_cpu_ptr(xfsstats.xs_stats, current_cpu())->a[off]++;        \
           ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 
'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro 
'__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   fs/xfs/libxfs/xfs_btree.c:2999:2: note: Loop condition is false.  Exiting 
loop
           XFS_BTREE_STATS_INC(cur, newroot);
           ^
   fs/xfs/libxfs/xfs_btree.h:91:2: note: expanded from macro 
'XFS_BTREE_STATS_INC'
           XFS_STATS_INC_OFF((cur)->bc_mp, (cur)->bc_statoff + __XBTS_ ## stat)
           ^
   fs/xfs/xfs_stats.h:184:2: note: expanded from macro 'XFS_STATS_INC_OFF'
           per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->a[off]++;     \
           ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 
'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro 
'__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   fs/xfs/libxfs/xfs_btree.c:2999:2: note: Loop condition is false.  Exiting 
loop
           XFS_BTREE_STATS_INC(cur, newroot);
           ^
   fs/xfs/libxfs/xfs_btree.h:91:2: note: expanded from macro 
'XFS_BTREE_STATS_INC'
           XFS_STATS_INC_OFF((cur)->bc_mp, (cur)->bc_statoff + __XBTS_ ## stat)
           ^
   fs/xfs/xfs_stats.h:181:39: note: expanded from macro 'XFS_STATS_INC_OFF'
   #define XFS_STATS_INC_OFF(mp, off)                              \
                                                                   ^
   fs/xfs/libxfs/xfs_btree.c:3006:6: note: Assuming 'error' is 0
           if (error)
               ^~~~~
   fs/xfs/libxfs/xfs_btree.c:3006:2: note: Taking false branch
           if (error)
           ^
   fs/xfs/libxfs/xfs_btree.c:3008:6: note: Assuming the condition is false
           if (*stat == 0)
               ^~~~~~~~~~
   fs/xfs/libxfs/xfs_btree.c:3008:2: note: Taking false branch
           if (*stat == 0)
           ^
   fs/xfs/libxfs/xfs_btree.c:3010:2: note: Loop condition is false.  Exiting 
loop
           XFS_BTREE_STATS_INC(cur, alloc);
           ^
   fs/xfs/libxfs/xfs_btree.h:91:2: note: expanded from macro 
'XFS_BTREE_STATS_INC'
           XFS_STATS_INC_OFF((cur)->bc_mp, (cur)->bc_statoff + __XBTS_ ## stat)
           ^
   fs/xfs/xfs_stats.h:183:2: note: expanded from macro 'XFS_STATS_INC_OFF'
           per_cpu_ptr(xfsstats.xs_stats, current_cpu())->a[off]++;        \
           ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 
'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro 
'__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   fs/xfs/libxfs/xfs_btree.c:3010:2: note: Loop condition is false.  Exiting 
loop
           XFS_BTREE_STATS_INC(cur, alloc);
           ^
   fs/xfs/libxfs/xfs_btree.h:91:2: note: expanded from macro 
'XFS_BTREE_STATS_INC'
           XFS_STATS_INC_OFF((cur)->bc_mp, (cur)->bc_statoff + __XBTS_ ## stat)
           ^
   fs/xfs/xfs_stats.h:184:2: note: expanded from macro 'XFS_STATS_INC_OFF'

vim +318 fs/xfs/xfs_buf.h

ce8e922c0e79c8 fs/xfs/linux-2.6/xfs_buf.h Nathan Scott 2006-01-11  315  
04fcad80cd0687 fs/xfs/xfs_buf.h           Dave Chinner 2021-08-18  316  static 
inline xfs_daddr_t xfs_buf_daddr(struct xfs_buf *bp)
04fcad80cd0687 fs/xfs/xfs_buf.h           Dave Chinner 2021-08-18  317  {
04fcad80cd0687 fs/xfs/xfs_buf.h           Dave Chinner 2021-08-18 @318          
return bp->b_maps[0].bm_bn;
04fcad80cd0687 fs/xfs/xfs_buf.h           Dave Chinner 2021-08-18  319  }
04fcad80cd0687 fs/xfs/xfs_buf.h           Dave Chinner 2021-08-18  320  

---
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