CC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Mark Zhang <[email protected]>

Hi Mark,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on rdma/for-next]
[also build test WARNING on linus/master v5.14-rc6]
[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]

url:    
https://github.com/0day-ci/linux/commits/Mark-Zhang/Optional-counter-statistics-support/20210818-192754
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
:::::: branch date: 23 hours ago
:::::: commit date: 23 hours ago
config: powerpc-randconfig-c003-20210818 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
d2b574a4dea5b718e4386bf2e26af0126e5978ce)
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 powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # 
https://github.com/0day-ci/linux/commit/271ea16b6bc4c4e101387e95ae9e4f91709fd417
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Mark-Zhang/Optional-counter-statistics-support/20210818-192754
        git checkout 271ea16b6bc4c4e101387e95ae9e4f91709fd417
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1035:2: note: Calling 'hid_map_usage'
           hid_map_usage(hidinput, usage, bit, max, type, c);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:982:2: note: 'input' initialized here
           struct input_dev *input = hidinput->input;
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:986:2: note: Control jumps to 'case 1:'  at line 995
           switch (type) {
           ^
   include/linux/hid.h:998:3: note:  Execution continues on line 1005
                   break;
                   ^
   include/linux/hid.h:1005:15: note: 'c' is <= 'limit'
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:15: note: Left side of '||' is false
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/hid.h:1005:28: note: Assuming 'bmap' is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:28: note: Assuming pointer value is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:2: note: Taking true branch
           if (unlikely(c > limit || !bmap)) {
           ^
   include/linux/hid.h:1006:3: note: Assuming the condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:540:6: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
               ^~~~~~~~~~~~~~~~~
   include/linux/ratelimit_types.h:41:28: note: expanded from macro 
'__ratelimit'
   #define __ratelimit(state) ___ratelimit(state, __func__)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1006:3: note: Taking true branch
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:540:2: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
           ^
   include/linux/hid.h:1007:9: note: Access to field 'name' results in a 
dereference of a null pointer (loaded from variable 'input')
                                       input->name, c, type);
                                       ^
   include/linux/printk.h:557:49: note: expanded from macro 
'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
                                                          ^~~~~~~~~~~
   include/linux/printk.h:541:17: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                                 ^~~~~~~~~~~
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   16 warnings generated.
   Suppressed 16 warnings (16 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   19 warnings generated.
   drivers/infiniband/core/counters.c:147:3: warning: Value stored to 'ret' is 
never read [clang-analyzer-deadcode.DeadStores]
                   ret = -EOPNOTSUPP;
                   ^     ~~~~~~~~~~~
   drivers/infiniband/core/counters.c:147:3: note: Value stored to 'ret' is 
never read
                   ret = -EOPNOTSUPP;
                   ^     ~~~~~~~~~~~
>> drivers/infiniband/core/counters.c:635:9: warning: Access to field 'hstats' 
>> results in a dereference of a null pointer (loaded from variable 
>> 'port_counter') [clang-analyzer-core.NullDereference]
                   kfree(port_counter->hstats);
                         ^~~~~~~~~~~~
   drivers/infiniband/core/counters.c:600:6: note: Assuming field 'port_data' 
is non-null
           if (!dev->port_data)
               ^~~~~~~~~~~~~~~
   drivers/infiniband/core/counters.c:600:2: note: Taking false branch
           if (!dev->port_data)
           ^
   drivers/infiniband/core/counters.c:603:2: note: Loop condition is true.  
Entering loop body
           rdma_for_each_port(dev, port) {
           ^
   include/rdma/ib_verbs.h:3039:2: note: expanded from macro 
'rdma_for_each_port'
           for (iter = rdma_start_port(device +                                 
  \
           ^
   drivers/infiniband/core/counters.c:606:3: note: Loop condition is false.  
Exiting loop
                   mutex_init(&port_counter->lock);
                   ^
   include/linux/mutex.h:113:32: note: expanded from macro 'mutex_init'
   #define mutex_init(mutex)                                               \
                                                                           ^
   drivers/infiniband/core/counters.c:608:7: note: Assuming field 
'alloc_hw_port_stats' is non-null
                   if (!dev->ops.alloc_hw_port_stats)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/counters.c:608:3: note: Taking false branch
                   if (!dev->ops.alloc_hw_port_stats)
                   ^
   drivers/infiniband/core/counters.c:611:26: note: Value assigned to field 
'port_data'
                   port_counter->hstats = dev->ops.alloc_hw_port_stats(dev, 
port);
                                          
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/counters.c:612:7: note: Assuming field 'hstats' is 
null
                   if (!port_counter->hstats)
                       ^~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/counters.c:612:3: note: Taking true branch
                   if (!port_counter->hstats)
                   ^
   drivers/infiniband/core/counters.c:613:4: note: Control jumps to line 628
                           goto fail;
                           ^
   drivers/infiniband/core/counters.c:628:2: note: Loop condition is true.  
Entering loop body
           for (i = port; i >= rdma_start_port(dev); i--) {
           ^
   drivers/infiniband/core/counters.c:629:3: note: Value assigned to 
'port_counter'
                   port_counter = &dev->port_data[port].port_counter;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/counters.c:630:7: note: Assuming 'port_counter' is 
null
                   if (port_counter && port_counter->opstats) {
                       ^~~~~~~~~~~~
   drivers/infiniband/core/counters.c:630:20: note: Left side of '&&' is false
                   if (port_counter && port_counter->opstats) {
                                    ^
   drivers/infiniband/core/counters.c:635:9: note: Access to field 'hstats' 
results in a dereference of a null pointer (loaded from variable 'port_counter')
                   kfree(port_counter->hstats);
                         ^~~~~~~~~~~~
   drivers/infiniband/core/counters.c:652:9: warning: Access to field 'hstats' 
results in a dereference of a null pointer (loaded from variable 
'port_counter') [clang-analyzer-core.NullDereference]
                   kfree(port_counter->hstats);
                         ^~~~~~~~~~~~
   drivers/infiniband/core/counters.c:646:2: note: Loop condition is true.  
Entering loop body
           rdma_for_each_port(dev, port) {
           ^
   include/rdma/ib_verbs.h:3039:2: note: expanded from macro 
'rdma_for_each_port'
           for (iter = rdma_start_port(device +                                 
  \
           ^
   drivers/infiniband/core/counters.c:647:3: note: Value assigned to 
'port_counter'
                   port_counter = &dev->port_data[port].port_counter;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/counters.c:648:7: note: Assuming 'port_counter' is 
null
                   if (port_counter && port_counter->opstats) {
                       ^~~~~~~~~~~~
   drivers/infiniband/core/counters.c:648:20: note: Left side of '&&' is false
                   if (port_counter && port_counter->opstats) {
                                    ^
   drivers/infiniband/core/counters.c:652:9: note: Access to field 'hstats' 
results in a dereference of a null pointer (loaded from variable 'port_counter')
                   kfree(port_counter->hstats);
                         ^~~~~~~~~~~~
   Suppressed 16 warnings (16 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   drivers/media/dvb-frontends/stv090x.c:2289:23: warning: The result of the 
'/' expression is undefined [clang-analyzer-core.UndefinedBinaryOperatorResult]
           steps_max = (car_max / inc) + 1; /* min steps = 3 */
                                ^
   drivers/media/dvb-frontends/stv090x.c:2405:2: note: Calling 
'stv090x_get_loop_params'
           stv090x_get_loop_params(state, &inc, &timeout_step, &steps_max);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/dvb-frontends/stv090x.c:2251:6: note: Assuming 'car_max' is <= 
16384
           if (car_max > 0x4000)
               ^~~~~~~~~~~~~~~~
   drivers/media/dvb-frontends/stv090x.c:2251:2: note: Taking false branch
           if (car_max > 0x4000)
           ^
   drivers/media/dvb-frontends/stv090x.c:2260:2: note: Control jumps to 'case 
STV090x_SEARCH_DVBS2:'  at line 2267
           switch (state->search_mode) {
           ^
   drivers/media/dvb-frontends/stv090x.c:2270:3: note:  Execution continues on 
line 2278
                   break;
                   ^
   drivers/media/dvb-frontends/stv090x.c:2279:7: note: Assuming 'inc' is <= 
'car_max'
           if ((inc > car_max) || (inc < 0))
                ^~~~~~~~~~~~~
   drivers/media/dvb-frontends/stv090x.c:2279:6: note: Left side of '||' is 
false
           if ((inc > car_max) || (inc < 0))

vim +635 drivers/infiniband/core/counters.c

83c2c1fcbd08ec Mark Zhang      2019-07-02  594  
413d3347503bc3 Mark Zhang      2019-07-02  595  void rdma_counter_init(struct 
ib_device *dev)
413d3347503bc3 Mark Zhang      2019-07-02  596  {
413d3347503bc3 Mark Zhang      2019-07-02  597          struct 
rdma_port_counter *port_counter;
56594ae1d250f8 Parav Pandit    2019-07-23  598          u32 port, i;
413d3347503bc3 Mark Zhang      2019-07-02  599  
d191152f43a586 Parav Pandit    2019-07-23  600          if (!dev->port_data)
413d3347503bc3 Mark Zhang      2019-07-02  601                  return;
413d3347503bc3 Mark Zhang      2019-07-02  602  
413d3347503bc3 Mark Zhang      2019-07-02  603          rdma_for_each_port(dev, 
port) {
413d3347503bc3 Mark Zhang      2019-07-02  604                  port_counter = 
&dev->port_data[port].port_counter;
413d3347503bc3 Mark Zhang      2019-07-02  605                  
port_counter->mode.mode = RDMA_COUNTER_MODE_NONE;
413d3347503bc3 Mark Zhang      2019-07-02  606                  
mutex_init(&port_counter->lock);
f34a55e497e813 Mark Zhang      2019-07-02  607  
4b5f4d3fb40898 Jason Gunthorpe 2021-06-11  608                  if 
(!dev->ops.alloc_hw_port_stats)
d191152f43a586 Parav Pandit    2019-07-23  609                          
continue;
d191152f43a586 Parav Pandit    2019-07-23  610  
4b5f4d3fb40898 Jason Gunthorpe 2021-06-11  611                  
port_counter->hstats = dev->ops.alloc_hw_port_stats(dev, port);
f34a55e497e813 Mark Zhang      2019-07-02  612                  if 
(!port_counter->hstats)
f34a55e497e813 Mark Zhang      2019-07-02  613                          goto 
fail;
271ea16b6bc4c4 Aharon Landau   2021-08-18  614  
271ea16b6bc4c4 Aharon Landau   2021-08-18  615                  if 
(dev->ops.alloc_op_port_stats) {
271ea16b6bc4c4 Aharon Landau   2021-08-18  616                          
port_counter->opstats =
271ea16b6bc4c4 Aharon Landau   2021-08-18  617                                  
dev->ops.alloc_op_port_stats(dev, port);
271ea16b6bc4c4 Aharon Landau   2021-08-18  618                          if 
(!port_counter->opstats)
271ea16b6bc4c4 Aharon Landau   2021-08-18  619                                  
goto fail;
271ea16b6bc4c4 Aharon Landau   2021-08-18  620  
271ea16b6bc4c4 Aharon Landau   2021-08-18  621                          
mutex_init(&port_counter->opstats->lock);
271ea16b6bc4c4 Aharon Landau   2021-08-18  622                  }
413d3347503bc3 Mark Zhang      2019-07-02  623          }
f34a55e497e813 Mark Zhang      2019-07-02  624  
f34a55e497e813 Mark Zhang      2019-07-02  625          return;
f34a55e497e813 Mark Zhang      2019-07-02  626  
f34a55e497e813 Mark Zhang      2019-07-02  627  fail:
56594ae1d250f8 Parav Pandit    2019-07-23  628          for (i = port; i >= 
rdma_start_port(dev); i--) {
f34a55e497e813 Mark Zhang      2019-07-02  629                  port_counter = 
&dev->port_data[port].port_counter;
271ea16b6bc4c4 Aharon Landau   2021-08-18  630                  if 
(port_counter && port_counter->opstats) {
271ea16b6bc4c4 Aharon Landau   2021-08-18  631                          
mutex_destroy(&port_counter->opstats->lock);
271ea16b6bc4c4 Aharon Landau   2021-08-18  632                          
kfree(port_counter->opstats);
271ea16b6bc4c4 Aharon Landau   2021-08-18  633                          
port_counter->opstats = NULL;
271ea16b6bc4c4 Aharon Landau   2021-08-18  634                  }
f34a55e497e813 Mark Zhang      2019-07-02 @635                  
kfree(port_counter->hstats);
f34a55e497e813 Mark Zhang      2019-07-02  636                  
port_counter->hstats = NULL;
56594ae1d250f8 Parav Pandit    2019-07-23  637                  
mutex_destroy(&port_counter->lock);
f34a55e497e813 Mark Zhang      2019-07-02  638          }
413d3347503bc3 Mark Zhang      2019-07-02  639  }
413d3347503bc3 Mark Zhang      2019-07-02  640  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to