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/linux/kernel/git/torvalds/linux.git 
master
head:   6441998e2e37131b0a4c310af9156d79d3351c16
commit: 4c7f65aea7b7fe66c08f8f7304c1ea3f7a871d5a xfs: rename buffer cache index 
variable b_bn
date:   4 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 4 months ago
config: riscv-randconfig-c006-20211214 
(https://download.01.org/0day-ci/archive/20211217/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
b6a2ddb6c8ac29412b1361810972e15221fa021c)
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/linux/kernel/git/torvalds/linux.git/commit/?id=4c7f65aea7b7fe66c08f8f7304c1ea3f7a871d5a
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4c7f65aea7b7fe66c08f8f7304c1ea3f7a871d5a
        # save the config file 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 >>)
           return rq->cfs.nr_running > 0;
                  ^~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/sched.h:2228:2: note: Returning without writing to 
'rq->cfs.tasks_timeline.rb_leftmost', which participates in a condition later
           return rq->cfs.nr_running > 0;
           ^
   kernel/sched/sched.h:2228:2: note: Returning without writing to 
'rq->cfs.next', which participates in a condition later
   kernel/sched/fair.c:7200:7: note: Returning from 'sched_fair_runnable'
           if (!sched_fair_runnable(rq))
                ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:7200:2: note: Taking false branch
           if (!sched_fair_runnable(rq))
           ^
   kernel/sched/fair.c:7281:6: note: 'prev' is null
           if (prev)
               ^~~~
   kernel/sched/fair.c:7281:2: note: Taking false branch
           if (prev)
           ^
   kernel/sched/fair.c:7285:33: note: Passing null pointer value via 2nd 
parameter 'curr'
                   se = pick_next_entity(cfs_rq, NULL);
                                                 ^
   include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
   #define NULL ((void *)0)
                ^~~~~~~~~~~
   kernel/sched/fair.c:7285:8: note: Calling 'pick_next_entity'
                   se = pick_next_entity(cfs_rq, NULL);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:4494:30: note: Calling '__pick_first_entity'
           struct sched_entity *left = __pick_first_entity(cfs_rq);
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:560:6: note: Assuming 'left' is null
           if (!left)
               ^~~~~
   kernel/sched/fair.c:560:2: note: Taking true branch
           if (!left)
           ^
   kernel/sched/fair.c:561:3: note: Returning without writing to 
'cfs_rq->next', which participates in a condition later
                   return NULL;
                   ^
   kernel/sched/fair.c:561:3: note: Returning null pointer, which participates 
in a condition later
                   return NULL;
                   ^~~~~~~~~~~
   kernel/sched/fair.c:4494:30: note: Returning from '__pick_first_entity'
           struct sched_entity *left = __pick_first_entity(cfs_rq);
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:4501:7: note: 'left' is null
           if (!left || (curr && entity_before(curr, left)))
                ^~~~
   kernel/sched/fair.c:4501:12: note: Left side of '||' is true
           if (!left || (curr && entity_before(curr, left)))
                     ^
   kernel/sched/fair.c:4502:3: note: Null pointer value stored to 'left'
                   left = curr;
                   ^~~~~~~~~~~
   kernel/sched/fair.c:4510:6: note: Assuming field 'skip' is null
           if (cfs_rq->skip && cfs_rq->skip == se) {
               ^~~~~~~~~~~~
   kernel/sched/fair.c:4510:19: note: Left side of '&&' is false
           if (cfs_rq->skip && cfs_rq->skip == se) {
                            ^
   kernel/sched/fair.c:4525:6: note: Assuming field 'next' is non-null
           if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) {
               ^~~~~~~~~~~~
   kernel/sched/fair.c:4525:6: note: Left side of '&&' is true
   kernel/sched/fair.c:4525:58: note: Passing null pointer value via 2nd 
parameter 'se'
           if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) {
                                                                   ^~~~
   kernel/sched/fair.c:4525:22: note: Calling 'wakeup_preempt_entity'
           if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:7030:37: note: Access to field 'vruntime' results in a 
dereference of a null pointer (loaded from variable 'se')
           s64 gran, vdiff = curr->vruntime - se->vruntime;
                                              ^~
   Suppressed 22 warnings (5 in non-user code, 17 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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   5 warnings generated.
>> fs/xfs/xfs_buf.c:284:7: warning: Array access (via field 'b_pages') results 
>> in a null pointer dereference [clang-analyzer-core.NullDereference]
                   if (bp->b_pages[i])
                       ^
   fs/xfs/xfs_buf.c:874:10: note: Calling 'xfs_buf_get_uncached'
           error = xfs_buf_get_uncached(target, numblks, flags, &bp);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_buf.c:910:10: note: Calling '_xfs_buf_alloc'
           error = _xfs_buf_alloc(target, &map, 1, flags & XBF_NO_IOACCT, &bp);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_buf.c:238:2: note: Loop condition is false.  Exiting loop
           spin_lock_init(&bp->b_lock);
           ^
   include/linux/spinlock.h:334:35: note: expanded from macro 'spin_lock_init'
   # define spin_lock_init(lock)                                   \
                                                                   ^
   fs/xfs/xfs_buf.c:248:10: note: Calling 'xfs_buf_get_maps'
           error = xfs_buf_get_maps(bp, nmaps);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_buf.c:185:6: note: 'map_count' is equal to 1
           if (map_count == 1) {
               ^~~~~~~~~
   fs/xfs/xfs_buf.c:185:2: note: Taking true branch
           if (map_count == 1) {
           ^
   fs/xfs/xfs_buf.c:187:3: note: Returning without writing to 'bp->b_pages'
                   return 0;
                   ^
   fs/xfs/xfs_buf.c:248:10: note: Returning from 'xfs_buf_get_maps'
           error = xfs_buf_get_maps(bp, nmaps);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_buf.c:249:6: note: 'error' is 0
           if (error)  {
               ^~~~~
   fs/xfs/xfs_buf.c:249:2: note: Taking false branch
           if (error)  {
           ^
   fs/xfs/xfs_buf.c:256:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < nmaps; i++) {
           ^
   fs/xfs/xfs_buf.c:256:2: note: Loop condition is false. Execution continues 
on line 262
   fs/xfs/xfs_buf.c:263:2: note: Loop condition is false.  Exiting loop
           init_waitqueue_head(&bp->b_waiters);
           ^
   include/linux/wait.h:67:2: note: expanded from macro 'init_waitqueue_head'
           do {                                                                 
   \
           ^
   fs/xfs/xfs_buf.c:265:2: note: Loop condition is false.  Exiting loop
           XFS_STATS_INC(bp->b_mount, xb_create);
           ^
   fs/xfs/xfs_stats.h:165:2: note: expanded from macro 'XFS_STATS_INC'
           per_cpu_ptr(xfsstats.xs_stats, current_cpu())->s.v++;   \
           ^
   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/xfs_buf.c:265:2: note: Loop condition is false.  Exiting loop
           XFS_STATS_INC(bp->b_mount, xb_create);
           ^
   fs/xfs/xfs_stats.h:166:2: note: expanded from macro 'XFS_STATS_INC'
           per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->s.v++;        \
           ^
   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/xfs_buf.c:265:2: note: Loop condition is false.  Exiting loop
           XFS_STATS_INC(bp->b_mount, xb_create);
           ^
   fs/xfs/xfs_stats.h:163:34: note: expanded from macro 'XFS_STATS_INC'
   #define XFS_STATS_INC(mp, v)                                    \
                                                                   ^
   fs/xfs/xfs_buf.c:266:2: note: Calling 'trace_xfs_buf_init'
           trace_xfs_buf_init(bp, _RET_IP_);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_trace.h:448:1: note: Returning without writing to 'bp->b_pages'
   DEFINE_BUF_EVENT(xfs_buf_init);
   ^
   fs/xfs/xfs_trace.h:444:32: note: expanded from macro 'DEFINE_BUF_EVENT'
   #define DEFINE_BUF_EVENT(name) \
                                  ^
   include/linux/tracepoint.h:542:2: note: expanded from macro '\DEFINE_EVENT'
           DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
           ^
   include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
           __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),              \
           ^
   include/linux/tracepoint.h:343:4: note: expanded from macro '__DECLARE_TRACE'
           { }                                                             \
             ^
   fs/xfs/xfs_buf.c:266:2: note: Returning from 'trace_xfs_buf_init'

vim +/b_pages +284 fs/xfs/xfs_buf.c

^1da177e4c3f415 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds    2005-04-16  271  
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  272  
static void
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  273  
xfs_buf_free_pages(
e82226138b20d4f fs/xfs/xfs_buf.c           Dave Chinner      2020-12-16  274    
struct xfs_buf  *bp)
^1da177e4c3f415 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds    2005-04-16  275  {
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  276    
uint            i;
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  277  
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  278    
ASSERT(bp->b_flags & _XBF_PAGES);
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  279  
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  280    
if (xfs_buf_is_vmapped(bp))
54cd3aa6f8102f4 fs/xfs/xfs_buf.c           Christoph Hellwig 2021-06-07  281    
        vm_unmap_ram(bp->b_addr, bp->b_page_count);
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  282  
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  283    
for (i = 0; i < bp->b_page_count; i++) {
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01 @284    
        if (bp->b_pages[i])
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  285    
                __free_page(bp->b_pages[i]);
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  286    
}
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  287    
if (current->reclaim_state)
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  288    
        current->reclaim_state->reclaimed_slab += bp->b_page_count;
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  289  
02c5117386884e0 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  290    
if (bp->b_pages != bp->b_page_array)
f0e2d93c29dc39f fs/xfs/linux-2.6/xfs_buf.c Denys Vlasenko    2008-05-19  291    
        kmem_free(bp->b_pages);
3fc98b1ac036675 fs/xfs/linux-2.6/xfs_buf.c Dave Chinner      2009-12-14  292    
bp->b_pages = NULL;
e7d236a6fe51020 fs/xfs/xfs_buf.c           Dave Chinner      2021-06-01  293    
bp->b_flags &= ~_XBF_PAGES;
^1da177e4c3f415 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds    2005-04-16  294  }
^1da177e4c3f415 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds    2005-04-16  295  

:::::: The code at line 284 was first introduced by commit
:::::: e7d236a6fe5102092c463112124cf52e4d71885e xfs: move page freeing into 
_xfs_buf_free_pages()

:::::: 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]
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to