Hi Ryan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on v6.16]
[also build test WARNING on linus/master next-20250815]
[cannot apply to trace/for-next v6.17-rc1]
[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/Ryan-Chung/trace-trace_fprobe-c-TODO-handle-filter-nofilter-or-symbol-list/20250813-002748
base:   v6.16
patch link:    
https://lore.kernel.org/r/20250812162101.5981-1-seokwoo.chung130%40gmail.com
patch subject: [PATCH] trace/trace_fprobe.c: TODO: handle filter, nofilter or 
symbol list
config: s390-randconfig-r073-20250817 
(https://download.01.org/0day-ci/archive/20250817/[email protected]/config)
compiler: s390-linux-gcc (GCC) 8.5.0

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]/

smatch warnings:
kernel/trace/trace_fprobe.c:768 __register_trace_fprobe() warn: inconsistent 
indenting

vim +768 kernel/trace/trace_fprobe.c

   732  
   733  /* Internal register function - just handle fprobe and flags */
   734  static int __register_trace_fprobe(struct trace_fprobe *tf)
   735  {
   736          int i, ret;
   737  
   738          /* Should we need new LOCKDOWN flag for fprobe? */
   739          ret = security_locked_down(LOCKDOWN_KPROBES);
   740          if (ret)
   741                  return ret;
   742  
   743          if (trace_fprobe_is_registered(tf))
   744                  return -EINVAL;
   745  
   746          for (i = 0; i < tf->tp.nr_args; i++) {
   747                  ret = traceprobe_update_arg(&tf->tp.args[i]);
   748                  if (ret)
   749                          return ret;
   750          }
   751  
   752          /* Set/clear disabled flag according to tp->flag */
   753          if (trace_probe_is_enabled(&tf->tp))
   754                  tf->fp.flags &= ~FPROBE_FL_DISABLED;
   755          else
   756                  tf->fp.flags |= FPROBE_FL_DISABLED;
   757  
   758          if (trace_fprobe_is_tracepoint(tf)) {
   759  
   760                  /* This tracepoint is not loaded yet */
   761                  if (tf->tpoint == TRACEPOINT_STUB)
   762                          return 0;
   763  
   764                  return __regsiter_tracepoint_fprobe(tf);
   765          }
   766  
   767      /* Parse tf->symbol */
 > 768      {
   769          char *spec, *bang, *p;
   770          int n = 0, w = 0, j, rc;
   771          char **syms = NULL;
   772  
   773          spec = kstrdup(tf->symbol, GFP_KERNEL);
   774          if (!spec)
   775              return -ENOMEM;
   776  
   777          /* If a '!' exists, treat it as single symbol + filter */
   778          bang = strchr(spec, '!');
   779          if (bang) {
   780              char *sym, *flt;
   781  
   782              *bang = '\0';
   783              sym = strim(spec);
   784              flt = strim(bang + 1);
   785  
   786              if (!*sym || !*flt) {
   787                  kfree(spec);
   788                  return -EINVAL; /* reject empty symbol/filter */
   789              }
   790  
   791              rc = register_fprobe(&tf->fp, sym, flt);
   792              kfree(spec);
   793              return rc;
   794          }
   795  
   796          /* Comma list (or single symbol without '!') */
   797          /* First pass: count non-empty tokens */
   798          p = spec;
   799          while (p) {
   800              char *tok = strsep(&p, ",");
   801              if (tok && *strim(tok))
   802                  n++;
   803          }
   804  
   805          if (n == 0){
   806              kfree(spec);
   807              return -EINVAL;
   808          }
   809  
   810          /* Allocate array for pointers into spec (callee 
copies/consumes) */
   811          syms = kcalloc(n, sizeof(*syms), GFP_KERNEL);
   812          if (!syms) {
   813              kfree(spec);
   814              return -ENOMEM;
   815          }
   816  
   817          /* Second pass: fill, skipping empties */
   818          p = spec;
   819          while (p) {
   820              char *tok = strsep(&p, ",");
   821              char *s;
   822  
   823              if (!tok)
   824                  break;
   825              s = strim(tok);
   826              if (!*s)
   827                  continue;
   828              syms[w++] = s; 
   829          }
   830          
   831          /* Dedup in-place */
   832          for (i = 0; i < w; i++){
   833              if (!syms[i])
   834                  continue;
   835              for (j = i + 1; j < w; j++) {
   836                  if (syms[j] && !strcmp(syms[i], syms[j]))
   837                      syms[j] = NULL;
   838              }
   839          }
   840  
   841          /* Compact */
   842          for (i = 0, j = 0; i < w; i++) {
   843              if (syms[i])
   844                  syms[j++] = syms[i];
   845          }
   846          w = j;
   847  
   848          /* After dedup, ensure we still have at least one symbol */
   849          if (w == 0){
   850              kfree(syms);
   851              kfree(spec);
   852              return -EINVAL;
   853          }
   854  
   855          /* Register list or single symbol, using the existing bulk API 
*/
   856          if (w == 1)
   857              rc = register_fprobe(&tf->fp, syms[0], NULL);
   858          else
   859              rc = register_fprobe_syms(&tf->fp, (const char **)syms, w);
   860  
   861          kfree(syms);
   862          kfree(spec);
   863          return rc;
   864      }
   865  }
   866  

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

Reply via email to