:::::: :::::: Manual check reason: "low confidence static check warning: kernel/trace/trace_osnoise.c:108:9: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]" ::::::
CC: [email protected] CC: [email protected] BCC: [email protected] CC: [email protected] TO: Daniel Bristot de Oliveira <[email protected]> CC: "Steven Rostedt (VMware)" <[email protected]> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 3d9f55c57bc3659f986acc421eac431ff6edcc83 commit: bce29ac9ce0bb0b0b146b687ab978378c21e9078 trace: Add osnoise tracer date: 12 months ago :::::: branch date: 4 hours ago :::::: commit date: 12 months ago config: s390-randconfig-c005-20220605 (https://download.01.org/0day-ci/archive/20220610/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0a90b72c432d70aae035727ece4ba80ce820f381) 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 s390 cross compiling tool for clang build # apt-get install binutils-s390x-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bce29ac9ce0bb0b0b146b687ab978378c21e9078 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout bce29ac9ce0bb0b0b146b687ab978378c21e9078 # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) list_entry((pos)->member.next, typeof(*(pos)), member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:704:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ fs/inode.c:638:2: note: Taking false branch list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { ^ include/linux/list.h:716:7: note: expanded from macro 'list_for_each_entry_safe' n = list_next_entry(pos, member); \ ^ include/linux/list.h:555:2: note: expanded from macro 'list_next_entry' list_entry((pos)->member.next, typeof(*(pos)), member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ note: (skipping 2 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:308:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ fs/inode.c:638:2: note: Loop condition is false. Exiting loop list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { ^ include/linux/list.h:716:7: note: expanded from macro 'list_for_each_entry_safe' n = list_next_entry(pos, member); \ ^ include/linux/list.h:555:2: note: expanded from macro 'list_next_entry' list_entry((pos)->member.next, typeof(*(pos)), member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ note: (skipping 2 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 { \ ^ fs/inode.c:638:2: note: Loop condition is true. Entering loop body list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { ^ include/linux/list.h:715:2: note: expanded from macro 'list_for_each_entry_safe' for (pos = list_first_entry(head, typeof(*pos), member), \ ^ fs/inode.c:639:7: note: Assuming the condition is false if (atomic_read(&inode->i_count)) ^ include/asm-generic/atomic-instrumented.h:30:21: note: expanded from macro 'atomic_read' #define atomic_read atomic_read ^ fs/inode.c:639:3: note: Taking false branch if (atomic_read(&inode->i_count)) ^ fs/inode.c:643:7: note: Assuming the condition is false if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/inode.c:643:3: note: Taking false branch if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) { ^ fs/inode.c:658:7: note: Calling 'need_resched' if (need_resched()) { ^~~~~~~~~~~~~~ include/linux/sched.h:1982:18: note: Dereference of null pointer return unlikely(tif_need_resched()); ^ include/linux/thread_info.h:165:28: note: expanded from macro 'tif_need_resched' #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) ^ include/linux/thread_info.h:131:22: note: expanded from macro 'test_thread_flag' test_ti_thread_flag(current_thread_info(), flag) ^ include/linux/thread_info.h:23:54: note: expanded from macro 'current_thread_info' #define current_thread_info() ((struct thread_info *)current) ^ arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current' #define current ((struct task_struct *const)S390_lowcore.current_task) ^ arch/s390/include/asm/lowcore.h:192:22: note: expanded from macro 'S390_lowcore' #define S390_lowcore (*((struct lowcore *) 0)) ^ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ Suppressed 19 warnings (7 in non-user code, 12 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. 32 warnings generated. >> kernel/trace/trace_osnoise.c:108:9: warning: Dereference of null pointer >> [clang-analyzer-core.NullDereference] return this_cpu_ptr(&per_cpu_osnoise_var); ^ include/linux/percpu-defs.h:252:27: note: expanded from macro 'this_cpu_ptr' #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) ^ include/linux/percpu-defs.h:242:2: note: expanded from macro 'raw_cpu_ptr' arch_raw_cpu_ptr(ptr); \ ^ include/asm-generic/percpu.h:44:31: note: expanded from macro 'arch_raw_cpu_ptr' #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) ^ include/linux/percpu-defs.h:231:2: note: expanded from macro 'SHIFT_PERCPU_PTR' RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)) ^ include/linux/compiler.h:182:28: note: expanded from macro 'RELOC_HIDE' (typeof(ptr)) (__ptr + (off)); }) ^ kernel/trace/trace_osnoise.c:709:38: note: Calling 'this_cpu_osn_var' struct osnoise_variables *osn_var = this_cpu_osn_var(); ^~~~~~~~~~~~~~~~~~ kernel/trace/trace_osnoise.c:108:9: note: Loop condition is false. Exiting loop return this_cpu_ptr(&per_cpu_osnoise_var); ^ include/linux/percpu-defs.h:252:27: note: expanded from macro 'this_cpu_ptr' #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) ^ include/linux/percpu-defs.h:241:2: note: expanded from macro 'raw_cpu_ptr' __verify_pcpu_ptr(ptr); \ ^ include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr' #define __verify_pcpu_ptr(ptr) \ ^ kernel/trace/trace_osnoise.c:108:9: note: Dereference of null pointer return this_cpu_ptr(&per_cpu_osnoise_var); ^ include/linux/percpu-defs.h:252:27: note: expanded from macro 'this_cpu_ptr' #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) ^~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:242:2: note: expanded from macro 'raw_cpu_ptr' arch_raw_cpu_ptr(ptr); \ ^~~~~~~~~~~~~~~~~~~~~ include/asm-generic/percpu.h:44:31: note: expanded from macro 'arch_raw_cpu_ptr' #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:231:2: note: expanded from macro 'SHIFT_PERCPU_PTR' RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:182:28: note: expanded from macro 'RELOC_HIDE' (typeof(ptr)) (__ptr + (off)); }) ^~~~~ Suppressed 31 warnings (8 in non-user code, 23 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. 18 warnings generated. Suppressed 18 warnings (6 in non-user code, 12 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. 23 warnings generated. include/linux/sched/task_stack.h:83:32: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] void *stack = task_stack_page(current); ^ arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current' #define current ((struct task_struct *const)S390_lowcore.current_task) ^ arch/s390/include/asm/lowcore.h:192:22: note: expanded from macro 'S390_lowcore' #define S390_lowcore (*((struct lowcore *) 0)) ^ kernel/trace/trace_stack.c:159:19: note: Left side of '||' is false int frame_size = READ_ONCE(tracer_frame); ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word' (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ ^ kernel/trace/trace_stack.c:159:19: note: Left side of '||' is false int frame_size = READ_ONCE(tracer_frame); ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word' (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ ^ kernel/trace/trace_stack.c:159:19: note: Left side of '||' is true int frame_size = READ_ONCE(tracer_frame); ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:291:28: note: expanded from macro '__native_word' sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) vim +108 kernel/trace/trace_osnoise.c bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 102 bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 103 /* bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 104 * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 105 */ bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 106 static inline struct osnoise_variables *this_cpu_osn_var(void) bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 107 { bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 @108 return this_cpu_ptr(&per_cpu_osnoise_var); bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 109 } bce29ac9ce0bb0b Daniel Bristot de Oliveira 2021-06-22 110 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
