Hi Johannes,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mcgrof/modules-next]
[also build test WARNING on arnd-asm-generic/master tip/timers/core net/main 
net-next/main linus/master horms-ipvs/master v6.10-rc2 next-20240607]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    
https://github.com/intel-lab-lkp/linux/commits/Johannes-Berg/tracing-add-__print_sym-to-replace-__print_symbolic/20240608-000918
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git 
modules-next
patch link:    
https://lore.kernel.org/r/20240607160527.23624-7-johannes%40sipsolutions.net
patch subject: [PATCH v4 1/4] tracing: add __print_sym() to replace 
__print_symbolic()
config: i386-buildonly-randconfig-005-20240608 
(https://download.01.org/0day-ci/archive/20240608/[email protected]/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 
617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240608/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> kernel/trace/trace_events.c:1583:6: warning: variable 'n_sym_defs' is used 
>> uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    1583 |         if ((call->flags & TRACE_EVENT_FL_DYNAMIC) || !call->module) 
{
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/trace/trace_events.c:1595:18: note: uninitialized use occurs here
    1595 |         for (i = 0; i < n_sym_defs; i++) {
         |                         ^~~~~~~~~~
   kernel/trace/trace_events.c:1583:2: note: remove the 'if' if its condition 
is always true
    1583 |         if ((call->flags & TRACE_EVENT_FL_DYNAMIC) || !call->module) 
{
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/trace/trace_events.c:1581:25: note: initialize the variable 
'n_sym_defs' to silence this warning
    1581 |         unsigned int n_sym_defs, i;
         |                                ^
         |                                 = 0
   1 warning generated.


vim +1583 kernel/trace/trace_events.c

  1575  
  1576  /* note: @name is not NUL-terminated */
  1577  static void show_sym_list(struct seq_file *m, struct trace_event_call 
*call,
  1578                            const char *name, unsigned int name_len)
  1579  {
  1580          struct trace_sym_def **sym_defs;
  1581          unsigned int n_sym_defs, i;
  1582  
> 1583          if ((call->flags & TRACE_EVENT_FL_DYNAMIC) || !call->module) {
  1584                  sym_defs = __start_ftrace_sym_defs;
  1585                  n_sym_defs = __stop_ftrace_sym_defs - 
__start_ftrace_sym_defs;
  1586  #ifdef CONFIG_MODULES
  1587          } else {
  1588                  struct module *mod = call->module;
  1589  
  1590                  sym_defs = mod->trace_sym_defs;
  1591                  n_sym_defs = mod->num_trace_sym_defs;
  1592  #endif /* CONFIG_MODULES */
  1593          }
  1594  
  1595          for (i = 0; i < n_sym_defs; i++) {
  1596                  unsigned int sym_len;
  1597  
  1598                  if (!sym_defs[i])
  1599                          continue;
  1600                  if (sym_defs[i]->system != call->class->system)
  1601                          continue;
  1602                  sym_len = strlen(sym_defs[i]->symbol_id);
  1603                  if (name_len != sym_len)
  1604                          continue;
  1605                  if (strncmp(sym_defs[i]->symbol_id, name, sym_len))
  1606                          continue;
  1607                  if (sym_defs[i]->show)
  1608                          sym_defs[i]->show(m);
  1609                  break;
  1610          }
  1611  }
  1612  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Reply via email to