Hi Steven,

kernel test robot noticed the following build warnings:

[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v7.3-rc1 next-20260901]
[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/Steven-Rostedt/tracing-Take-trace_array-reference-when-opening-options-file/20260901-163620
base:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace 
for-next
patch link:    
https://lore.kernel.org/r/20260901163620.6cbe0ada%40gandalf.local.home
patch subject: [PATCH] tracing: Take trace_array reference when opening options 
file
config: openrisc-randconfig-r072-20260902 
(https://download.01.org/0day-ci/archive/20260902/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 14.3.0
smatch: v0.5.0-9187-g5189e3fb
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20260902/[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.c: In function 'trace_array_options_get':
>> kernel/trace/trace.c:7871:30: warning: comparison of distinct pointer types 
>> lacks a cast [-Wcompare-distinct-pointer-types]
    7871 |                 if (tr_index >= &tr->trace_flags_index[0] &&
         |                              ^~
   kernel/trace/trace.c:7872:30: warning: comparison of distinct pointer types 
lacks a cast [-Wcompare-distinct-pointer-types]
    7872 |                     tr_index < 
&tr->trace_flags_index[TRACE_FLAGS_MAX_SIZE])
         |                              ^


vim +7871 kernel/trace/trace.c

  7844  
  7845  /*
  7846   * The tr_index is the address of a trace_array->trace_flags_index[]
  7847   * element that holds the index of the trace flag. But since the
  7848   * trace_array reference has not been taken yet, it cannot be referenced
  7849   * as it could have been freed by a rmdir of the instance the 
trace_array
  7850   * represents.
  7851   *
  7852   * Search the list of trace_arrays and compare the tr_index to the
  7853   * address of the entire trace_array trace_flags_index array for each
  7854   * trace_array in the list. If one is matched, then take the reference
  7855   * and return it. If not, the trace_array no longer exits.
  7856   */
  7857  static int trace_array_options_get(void *tr_index)
  7858  {
  7859          struct trace_array *tr;
  7860          int ret;
  7861  
  7862          ret = security_locked_down(LOCKDOWN_TRACEFS);
  7863          if (ret)
  7864                  return ret;
  7865  
  7866          if (tracing_disabled)
  7867                  return -ENODEV;
  7868  
  7869          guard(mutex)(&trace_types_lock);
  7870          list_for_each_entry(tr, &ftrace_trace_arrays, list) {
> 7871                  if (tr_index >= &tr->trace_flags_index[0] &&
  7872                      tr_index < 
&tr->trace_flags_index[TRACE_FLAGS_MAX_SIZE])
  7873                          return __trace_array_get(tr);
  7874          }
  7875          return -ENODEV;
  7876  }
  7877  

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

Reply via email to