Hi Xiangning",

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    
https://github.com/0day-ci/linux/commits/YU-Xiangning/Lockless-Token-Bucket-LTB-Qdisc/20200707-020918
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
5bd6ff0c6fe6c138aebe8d3bf7163420386c7ca7
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 
02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> net/sched/sch_ltb.c:832:6: warning: variable 'err' is used uninitialized 
>> whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!opt)
               ^~~~
   net/sched/sch_ltb.c:882:9: note: uninitialized use occurs here
           return err;
                  ^~~
   net/sched/sch_ltb.c:832:2: note: remove the 'if' if its condition is always 
false
           if (!opt)
           ^~~~~~~~~
   net/sched/sch_ltb.c:830:9: note: initialize the variable 'err' to silence 
this warning
           int err;
                  ^
                   = 0
   1 warning generated.

vim +832 net/sched/sch_ltb.c

   817  
   818  static int ltb_change_class(struct Qdisc *sch, u32 classid,
   819                              u32 parentid, struct nlattr **tca,
   820                              unsigned long *arg, struct netlink_ext_ack 
*extack)
   821  {
   822          struct ltb_sched *ltb  = qdisc_priv(sch);
   823          struct ltb_class *cl = (struct ltb_class *)*arg, *parent;
   824          struct nlattr *opt = tca[TCA_OPTIONS];
   825          struct nlattr *tb[TCA_LTB_MAX + 1];
   826          struct tc_ltb_opt *lopt;
   827          u64 rate64, ceil64;
   828          struct psched_ratecfg ratecfg, ceilcfg;
   829          u32 prio;
   830          int err;
   831  
 > 832          if (!opt)
   833                  goto failure;
   834  
   835          err = nla_parse_nested_deprecated(tb, TCA_LTB_MAX, opt, 
ltb_policy,
   836                                            NULL);
   837          if (err < 0)
   838                  goto failure;
   839  
   840          err = -EINVAL;
   841          if (!tb[TCA_LTB_PARMS])
   842                  goto failure;
   843  
   844          parent = parentid == TC_H_ROOT ? NULL : ltb_find_class(sch, 
parentid);
   845  
   846          lopt = nla_data(tb[TCA_LTB_PARMS]);
   847          if (!lopt->rate.rate || !lopt->ceil.rate)
   848                  goto failure;
   849  
   850          rate64 = tb[TCA_LTB_RATE64] ? nla_get_u64(tb[TCA_LTB_RATE64]) : 
0;
   851          ceil64 = tb[TCA_LTB_CEIL64] ? nla_get_u64(tb[TCA_LTB_CEIL64]) : 
0;
   852          if (rate64 > ceil64)
   853                  goto failure;
   854  
   855          psched_ratecfg_precompute(&ratecfg, &lopt->rate, rate64);
   856          psched_ratecfg_precompute(&ceilcfg, &lopt->ceil, ceil64);
   857          prio = lopt->prio;
   858          if (prio >= TC_LTB_NUMPRIO)
   859                  prio = TC_LTB_NUMPRIO - 1;
   860  
   861          if (!cl) {
   862                  if (!classid || TC_H_MAJ(classid ^ sch->handle) ||
   863                      ltb_find_class(sch, classid)) {
   864                          err = -EINVAL;
   865                          goto failure;
   866                  }
   867                  cl = ltb_alloc_class(sch, parent, classid, &ratecfg, 
&ceilcfg,
   868                                       prio);
   869                  if (!cl) {
   870                          err = -ENOBUFS;
   871                          goto failure;
   872                  }
   873          } else {
   874                  /* Modify existing class */
   875                  ltb_modify_class(sch, cl, &ratecfg, &ceilcfg, prio);
   876          }
   877          qdisc_class_hash_grow(sch, &ltb->clhash);
   878          *arg = (unsigned long)cl;
   879          return 0;
   880  
   881  failure:
   882          return err;
   883  }
   884  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to