CC: kbuild-...@lists.01.org
BCC: l...@intel.com
TO: Jim Cromie <jim.cro...@gmail.com>

tree:   https://github.com/jimc/linux.git dyndbg-next
head:   e603de8993c46111c3ceeee8a8b9d5e7fa9af7cd
commit: bd35fd3540c38d57ed3f80330e0f76417a4fa9e3 [6/7] dyndbg: WIP use symbolic 
class names
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
compiler: powerpc64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> lib/dynamic_debug.c:649:18: warning: Either the condition 'p' is redundant 
>> or there is overflow in pointer subtraction. 
>> [nullPointerArithmeticRedundantCheck]
     } else if (*(p - 1) == '!') {
                    ^
   lib/dynamic_debug.c:644:7: note: Assuming that condition 'p' is not redundant
     if (p)
         ^
   lib/dynamic_debug.c:649:18: note: Null pointer subtraction
     } else if (*(p - 1) == '!') {
                    ^
>> lib/dynamic_debug.c:626:16: warning: Variable 'inbits' is not assigned a 
>> value. [unassignedVariable]
    unsigned long inbits;
                  ^
>> lib/dynamic_debug.c:669:15: warning: Uninitialized variable: inbits 
>> [uninitvar]
    *dcp->bits = inbits;
                 ^

vim +/p +649 lib/dynamic_debug.c

bd35fd3540c38d Jim Cromie 2022-03-21  623  
bd35fd3540c38d Jim Cromie 2022-03-21  624  static int 
param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp)
bd35fd3540c38d Jim Cromie 2022-03-21  625  {
bd35fd3540c38d Jim Cromie 2022-03-21 @626       unsigned long inbits;
bd35fd3540c38d Jim Cromie 2022-03-21  627       int idx_rc, matches = 0, totct 
= 0;
bd35fd3540c38d Jim Cromie 2022-03-21  628       char query[FMT_QUERY_SIZE];
bd35fd3540c38d Jim Cromie 2022-03-21  629       struct dyndbg_classbits_param 
*dcp = kp->arg;
bd35fd3540c38d Jim Cromie 2022-03-21  630       bool negate;
bd35fd3540c38d Jim Cromie 2022-03-21  631       char *cls, *p;
bd35fd3540c38d Jim Cromie 2022-03-21  632  
bd35fd3540c38d Jim Cromie 2022-03-21  633       if (!dcp) {
bd35fd3540c38d Jim Cromie 2022-03-21  634               
pr_err("set_dyndbg_classbits: no bits=>queries map\n");
bd35fd3540c38d Jim Cromie 2022-03-21  635               return -EINVAL;
bd35fd3540c38d Jim Cromie 2022-03-21  636       }
bd35fd3540c38d Jim Cromie 2022-03-21  637       if (!dcp->class_names) {
bd35fd3540c38d Jim Cromie 2022-03-21  638               pr_err("module 
-get-classes: no classes\n");
bd35fd3540c38d Jim Cromie 2022-03-21  639               return -EINVAL;
bd35fd3540c38d Jim Cromie 2022-03-21  640       }
bd35fd3540c38d Jim Cromie 2022-03-21  641       cls = kstrdup(instr, 
GFP_KERNEL);
bd35fd3540c38d Jim Cromie 2022-03-21  642  
bd35fd3540c38d Jim Cromie 2022-03-21  643       for (p = strchr(cls, ','); cls; 
cls = strchr(p, ',')) {
bd35fd3540c38d Jim Cromie 2022-03-21  644               if (p)
bd35fd3540c38d Jim Cromie 2022-03-21  645                       *p++ = 0; /* 
chop and advance on comma */
bd35fd3540c38d Jim Cromie 2022-03-21  646               if (*cls == '!') {
bd35fd3540c38d Jim Cromie 2022-03-21  647                       negate = true;
bd35fd3540c38d Jim Cromie 2022-03-21  648                       cls++;
bd35fd3540c38d Jim Cromie 2022-03-21 @649               } else if (*(p - 1) == 
'!') {
bd35fd3540c38d Jim Cromie 2022-03-21  650                       negate = true;
bd35fd3540c38d Jim Cromie 2022-03-21  651                       *(p - 1) = '0';
bd35fd3540c38d Jim Cromie 2022-03-21  652               }
bd35fd3540c38d Jim Cromie 2022-03-21  653               idx_rc = 
match_string(dcp->class_names, _DPRINTK_CLASS_DFLT, cls);
bd35fd3540c38d Jim Cromie 2022-03-21  654               if (idx_rc < 0) {
bd35fd3540c38d Jim Cromie 2022-03-21  655                       pr_err("%s not 
found for module: %s\n", cls, KP_MOD_NAME);
bd35fd3540c38d Jim Cromie 2022-03-21  656                       return idx_rc;
bd35fd3540c38d Jim Cromie 2022-03-21  657               }
bd35fd3540c38d Jim Cromie 2022-03-21  658               if (negate == 
test_bit(idx_rc, dcp->bits))
bd35fd3540c38d Jim Cromie 2022-03-21  659                       continue;
bd35fd3540c38d Jim Cromie 2022-03-21  660  
bd35fd3540c38d Jim Cromie 2022-03-21  661               snprintf(query, 
FMT_QUERY_SIZE, "class %s %c%s",
bd35fd3540c38d Jim Cromie 2022-03-21  662                        cls, !!negate 
? '-' : '+', dcp->flags);
bd35fd3540c38d Jim Cromie 2022-03-21  663  
bd35fd3540c38d Jim Cromie 2022-03-21  664               matches = 
ddebug_exec_queries(query, KP_MOD_NAME);
bd35fd3540c38d Jim Cromie 2022-03-21  665  
bd35fd3540c38d Jim Cromie 2022-03-21  666               v2pr_info("%d matches 
on class:%s\n", matches, cls);
bd35fd3540c38d Jim Cromie 2022-03-21  667               totct += matches;
bd35fd3540c38d Jim Cromie 2022-03-21  668       }
bd35fd3540c38d Jim Cromie 2022-03-21 @669       *dcp->bits = inbits;
bd35fd3540c38d Jim Cromie 2022-03-21  670       vpr_info("total matches: %d\n", 
totct);
bd35fd3540c38d Jim Cromie 2022-03-21  671       return 0;
bd35fd3540c38d Jim Cromie 2022-03-21  672  }
bd35fd3540c38d Jim Cromie 2022-03-21  673  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to