On Tue, Jun 14, 2022 at 7:37 AM Dan Carpenter <[email protected]>
wrote:

> tree:   https://github.com/jimc/linux.git  ddn3h
> head:   4ec4d6e7cc8be5dbb9fc98fa7d186eb3c92279f6
> commit: a989dd267981b06281b4d068bc5b1cf34fd24932 [20/23] dyndbg: support
> symbolic class-names in class_bitmap
> config: parisc-randconfig-m031-20220613 (
> https://download.01.org/0day-ci/archive/20220614/[email protected]/config
> )
> compiler: hppa-linux-gcc (GCC) 11.3.0
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
>
> smatch warnings:
> lib/dynamic_debug.c:636 param_set_dyndbg_class_strings() warn: variable
> dereferenced before check 'dcp' (see line 630)
>
> vim +/dcp +636 lib/dynamic_debug.c
>
> a989dd267981b0 Jim Cromie 2022-04-06  627  static int
> param_set_dyndbg_class_strings(const char *instr, const struct kernel_param
> *kp)
> a989dd267981b0 Jim Cromie 2022-04-06  628  {
> a989dd267981b0 Jim Cromie 2022-04-06  629       const struct
> ddebug_classes_bitmap_param *dcp = kp->arg;
> a989dd267981b0 Jim Cromie 2022-04-06 @630       const struct
> ddebug_classes_map *map = dcp->map;
>
>              ^^^^^^^^
> Dereference
>
> a989dd267981b0 Jim Cromie 2022-04-06  631       unsigned long inbits;
> a989dd267981b0 Jim Cromie 2022-04-06  632       int idx_rc, totct = 0;
> a989dd267981b0 Jim Cromie 2022-04-06  633       bool wanted;
> a989dd267981b0 Jim Cromie 2022-04-06  634       char *cls, *p;
> a989dd267981b0 Jim Cromie 2022-04-06  635
> a989dd267981b0 Jim Cromie 2022-04-06 @636       if (!dcp || !dcp->map) {
>                                                     ^^^^
> Check for NULL too late.
>
>

yes, I moved deref up wo cleanup.
I think I got distracted by the "is deref safe here ?"
I guess YES, IFF the right kp is there. which the macros do.

thanks


> a989dd267981b0 Jim Cromie 2022-04-06  637
>  pr_err("set_dyndbg_classes: no bits=>queries map\n");
> a989dd267981b0 Jim Cromie 2022-04-06  638               return -EINVAL;
> a989dd267981b0 Jim Cromie 2022-04-06  639       }
> a989dd267981b0 Jim Cromie 2022-04-06  640
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp
> _______________________________________________
> kbuild mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
>
>
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to