All of lore.kernel.org
 help / color / mirror / Atom feed
* mm/backing-dev.c:694:1: warning: Address of stack memory associated with local variable 'processed' is still referred to by the global variable 'offline_cgwbs' upon returning to the caller. This will be a dangling reference [clang-analyzer-core.StackAddr...
@ 2021-09-05 16:36 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-09-05 16:36 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Roman Gushchin <guro@fb.com>
CC: "Matthew Wilcox (Oracle)" <willy@infradead.org>
CC: Jan Kara <jack@suse.cz>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   49624efa65ac9889f4e7c7b2452b2e6ce42ba37d
commit: c22d70a162d3cc177282c4487be4d54876ca55c8 writeback, cgroup: release dying cgwbs by switching attached inodes
date:   10 weeks ago
:::::: branch date: 22 hours ago
:::::: commit date: 10 weeks ago
config: arm-randconfig-c002-20210904 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1104e3258b5064e7110cc297e2cec60ac9acfc0a)
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/torvalds/linux.git/commit/?id=c22d70a162d3cc177282c4487be4d54876ca55c8
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c22d70a162d3cc177282c4487be4d54876ca55c8
        # save the attached .config 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 <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/gpu/drm/drm_file.c:584:8: note: Taking false branch
                           e = list_first_entry(&file_priv->event_list,
                               ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:706:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/gpu/drm/drm_file.c:584:8: note: Loop condition is false.  Exiting loop
                           e = list_first_entry(&file_priv->event_list,
                               ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:706:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/gpu/drm/drm_file.c:586:30: note: Use of memory after it is freed
                           file_priv->event_space += e->event->length;
                                                     ^~~~~~~~
   Suppressed 7 warnings (6 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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   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.
>> mm/backing-dev.c:694:1: warning: Address of stack memory associated with local variable 'processed' is still referred to by the global variable 'offline_cgwbs' upon returning to the caller.  This will be a dangling reference [clang-analyzer-core.StackAddressEscape]
   }
   ^
   mm/backing-dev.c:662:9: note: Assuming the condition is false
           while (!list_empty(&offline_cgwbs)) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/backing-dev.c:662:2: note: Loop condition is false. Execution continues on line 690
           while (!list_empty(&offline_cgwbs)) {
           ^
   mm/backing-dev.c:690:6: note: Assuming the condition is false
           if (!list_empty(&processed))
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   mm/backing-dev.c:690:2: note: '?' condition is false
           if (!list_empty(&processed))
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   mm/backing-dev.c:690:6: note: Assuming the condition is true
           if (!list_empty(&processed))
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   mm/backing-dev.c:690:2: note: '?' condition is true
           if (!list_empty(&processed))
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   mm/backing-dev.c:690:2: note: Taking true branch
           if (!list_empty(&processed))
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   mm/backing-dev.c:694:1: note: Address of stack memory associated with local variable 'processed' is still referred to by the global variable 'offline_cgwbs' upon returning to the caller.  This will be a dangling reference
   }
   ^
   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.
   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.
   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.
   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.
   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.
   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.
   drivers/regulator/rk808-regulator.c:272:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                   ret = regmap_write(rdev->regmap, rdev->desc->vsel_reg, val);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/regulator/rk808-regulator.c:272:3: note: Value stored to 'ret' is never read
                   ret = regmap_write(rdev->regmap, rdev->desc->vsel_reg, val);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   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.
   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.
   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.

vim +694 mm/backing-dev.c

52ebea749aaed1 Tejun Heo      2015-05-22  647  
c22d70a162d3cc Roman Gushchin 2021-06-28  648  /*
c22d70a162d3cc Roman Gushchin 2021-06-28  649   * cleanup_offline_cgwbs_workfn - try to release dying cgwbs
c22d70a162d3cc Roman Gushchin 2021-06-28  650   *
c22d70a162d3cc Roman Gushchin 2021-06-28  651   * Try to release dying cgwbs by switching attached inodes to the nearest
c22d70a162d3cc Roman Gushchin 2021-06-28  652   * living ancestor's writeback. Processed wbs are placed at the end
c22d70a162d3cc Roman Gushchin 2021-06-28  653   * of the list to guarantee the forward progress.
c22d70a162d3cc Roman Gushchin 2021-06-28  654   */
c22d70a162d3cc Roman Gushchin 2021-06-28  655  static void cleanup_offline_cgwbs_workfn(struct work_struct *work)
c22d70a162d3cc Roman Gushchin 2021-06-28  656  {
c22d70a162d3cc Roman Gushchin 2021-06-28  657  	struct bdi_writeback *wb;
c22d70a162d3cc Roman Gushchin 2021-06-28  658  	LIST_HEAD(processed);
c22d70a162d3cc Roman Gushchin 2021-06-28  659  
c22d70a162d3cc Roman Gushchin 2021-06-28  660  	spin_lock_irq(&cgwb_lock);
c22d70a162d3cc Roman Gushchin 2021-06-28  661  
c22d70a162d3cc Roman Gushchin 2021-06-28  662  	while (!list_empty(&offline_cgwbs)) {
c22d70a162d3cc Roman Gushchin 2021-06-28  663  		wb = list_first_entry(&offline_cgwbs, struct bdi_writeback,
c22d70a162d3cc Roman Gushchin 2021-06-28  664  				      offline_node);
c22d70a162d3cc Roman Gushchin 2021-06-28  665  		list_move(&wb->offline_node, &processed);
c22d70a162d3cc Roman Gushchin 2021-06-28  666  
c22d70a162d3cc Roman Gushchin 2021-06-28  667  		/*
c22d70a162d3cc Roman Gushchin 2021-06-28  668  		 * If wb is dirty, cleaning up the writeback by switching
c22d70a162d3cc Roman Gushchin 2021-06-28  669  		 * attached inodes will result in an effective removal of any
c22d70a162d3cc Roman Gushchin 2021-06-28  670  		 * bandwidth restrictions, which isn't the goal.  Instead,
c22d70a162d3cc Roman Gushchin 2021-06-28  671  		 * it can be postponed until the next time, when all io
c22d70a162d3cc Roman Gushchin 2021-06-28  672  		 * will be likely completed.  If in the meantime some inodes
c22d70a162d3cc Roman Gushchin 2021-06-28  673  		 * will get re-dirtied, they should be eventually switched to
c22d70a162d3cc Roman Gushchin 2021-06-28  674  		 * a new cgwb.
c22d70a162d3cc Roman Gushchin 2021-06-28  675  		 */
c22d70a162d3cc Roman Gushchin 2021-06-28  676  		if (wb_has_dirty_io(wb))
c22d70a162d3cc Roman Gushchin 2021-06-28  677  			continue;
c22d70a162d3cc Roman Gushchin 2021-06-28  678  
c22d70a162d3cc Roman Gushchin 2021-06-28  679  		if (!wb_tryget(wb))
c22d70a162d3cc Roman Gushchin 2021-06-28  680  			continue;
c22d70a162d3cc Roman Gushchin 2021-06-28  681  
c22d70a162d3cc Roman Gushchin 2021-06-28  682  		spin_unlock_irq(&cgwb_lock);
c22d70a162d3cc Roman Gushchin 2021-06-28  683  		while (cleanup_offline_cgwb(wb))
c22d70a162d3cc Roman Gushchin 2021-06-28  684  			cond_resched();
c22d70a162d3cc Roman Gushchin 2021-06-28  685  		spin_lock_irq(&cgwb_lock);
c22d70a162d3cc Roman Gushchin 2021-06-28  686  
c22d70a162d3cc Roman Gushchin 2021-06-28  687  		wb_put(wb);
c22d70a162d3cc Roman Gushchin 2021-06-28  688  	}
c22d70a162d3cc Roman Gushchin 2021-06-28  689  
c22d70a162d3cc Roman Gushchin 2021-06-28  690  	if (!list_empty(&processed))
c22d70a162d3cc Roman Gushchin 2021-06-28  691  		list_splice_tail(&processed, &offline_cgwbs);
c22d70a162d3cc Roman Gushchin 2021-06-28  692  
c22d70a162d3cc Roman Gushchin 2021-06-28  693  	spin_unlock_irq(&cgwb_lock);
c22d70a162d3cc Roman Gushchin 2021-06-28 @694  }
c22d70a162d3cc Roman Gushchin 2021-06-28  695  

---
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: 28851 bytes --]

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

only message in thread, other threads:[~2021-09-05 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-05 16:36 mm/backing-dev.c:694:1: warning: Address of stack memory associated with local variable 'processed' is still referred to by the global variable 'offline_cgwbs' upon returning to the caller. This will be a dangling reference [clang-analyzer-core.StackAddr 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.