CC: [email protected]
CC: [email protected]
In-Reply-To: 
<c9f15f122181f05f09fffd2380365b9925dd6427.1628422645.git.leo...@nvidia.com>
References: 
<c9f15f122181f05f09fffd2380365b9925dd6427.1628422645.git.leo...@nvidia.com>
TO: Leon Romanovsky <[email protected]>

Hi Leon,

I love your patch! Perhaps something to improve:

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

url:    
https://github.com/0day-ci/linux/commits/Leon-Romanovsky/devlink-Simplify-devlink-port-API-calls/20210808-194343
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
f9be84db09d2e8930319503683305781378a7dbf
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago
config: x86_64-randconfig-c001-20210808 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
41a6b50c25961addc04438b567ee1f4ef9e40f98)
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
        # 
https://github.com/0day-ci/linux/commit/30335171ca292d93926e3606fde0a3e76cf792a0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Leon-Romanovsky/devlink-Simplify-devlink-port-API-calls/20210808-194343
        git checkout 30335171ca292d93926e3606fde0a3e76cf792a0
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
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 >>)
   fs/fuse/dev.c:1677:14: note: '?' condition is false
           num_pages = min(num_pages, fc->max_pages);
                       ^
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^
   include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })
                   ^
   include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^
   fs/fuse/dev.c:1681:7: note: Calling 'kzalloc'
           ra = kzalloc(args_size, GFP_KERNEL);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:721:9: note: Uninitialized value stored to field 
'num_pages'
           return kmalloc(size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:721:2: note: Returning pointer, which participates in a 
condition later
           return kmalloc(size, flags | __GFP_ZERO);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/dev.c:1681:7: note: Returning from 'kzalloc'
           ra = kzalloc(args_size, GFP_KERNEL);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/dev.c:1682:6: note: Assuming 'ra' is non-null
           if (!ra)
               ^~~
   fs/fuse/dev.c:1682:2: note: Taking false branch
           if (!ra)
           ^
   fs/fuse/dev.c:1698:9: note: Assuming 'num' is not equal to 0
           while (num && ap->num_pages < num_pages) {
                  ^~~
   fs/fuse/dev.c:1698:9: note: Left side of '&&' is true
   fs/fuse/dev.c:1698:30: note: The left operand of '<' is a garbage value
           while (num && ap->num_pages < num_pages) {
                         ~~~~~~~~~~~~~ ^
   Suppressed 6 warnings (6 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   9 warnings generated.
   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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   9 warnings generated.
   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.
   11 warnings generated.
   net/core/net-sysfs.c:1719:2: warning: Value stored to 'txq' is never read 
[clang-analyzer-deadcode.DeadStores]
           txq = real_tx;
           ^     ~~~~~~~
   net/core/net-sysfs.c:1719:2: note: Value stored to 'txq' is never read
           txq = real_tx;
           ^     ~~~~~~~
   Suppressed 10 warnings (10 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.
   9 warnings generated.
   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.
   60 warnings generated.
   Suppressed 60 warnings (58 in non-user code, 2 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   9 warnings generated.
   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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   70 warnings generated.
>> net/core/devlink.c:1283:8: warning: Called function pointer is null (null 
>> dereference) [clang-analyzer-core.CallAndMessage]
           err = devlink_port->devlink->ops->port_type_set(devlink_port,
                 ^
   net/core/devlink.c:1383:6: note: Assuming the condition is true
           if (info->attrs[DEVLINK_ATTR_PORT_TYPE]) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:1383:2: note: Taking true branch
           if (info->attrs[DEVLINK_ATTR_PORT_TYPE]) {
           ^
   net/core/devlink.c:1387:9: note: Calling 'devlink_port_type_set'
                   err = devlink_port_type_set(devlink_port, port_type);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:1277:6: note: Assuming field 'port_type_set' is null
           if (devlink_port->devlink->ops->port_type_set)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:1277:2: note: Taking false branch
           if (devlink_port->devlink->ops->port_type_set)
           ^
   net/core/devlink.c:1280:6: note: Assuming 'port_type' is not equal to field 
'type'
           if (port_type == devlink_port->type)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:1280:2: note: Taking false branch
           if (port_type == devlink_port->type)
           ^
   net/core/devlink.c:1283:8: note: Called function pointer is null (null 
dereference)
           err = devlink_port->devlink->ops->port_type_set(devlink_port,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:4316:15: warning: Use of memory after it is freed 
[clang-analyzer-unix.Malloc]
                   if (!strcmp(param_item->param->name, param_name))
                               ^
   net/core/devlink.c:9956:9: note: Calling '__devlink_params_unregister'
           return __devlink_params_unregister(devlink_port->devlink,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:9838:14: note: Assuming 'i' is < 'params_count'
           for (i = 0; i < params_count; i++, param++)
                       ^~~~~~~~~~~~~~~~
   net/core/devlink.c:9838:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < params_count; i++, param++)
           ^
   net/core/devlink.c:9839:3: note: Calling 'devlink_param_unregister_one'
                   devlink_param_unregister_one(devlink, 0, param_list, param,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:4805:11: note: 'param_item' is non-null
           WARN_ON(!param_item);
                    ^
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   net/core/devlink.c:4805:2: note: Taking false branch
           WARN_ON(!param_item);
           ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   net/core/devlink.c:4808:2: note: Memory is released
           kfree(param_item);
           ^~~~~~~~~~~~~~~~~
   net/core/devlink.c:9839:3: note: Returning; memory was released
                   devlink_param_unregister_one(devlink, 0, param_list, param,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:9838:14: note: Assuming 'i' is < 'params_count'
           for (i = 0; i < params_count; i++, param++)
                       ^~~~~~~~~~~~~~~~
   net/core/devlink.c:9838:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < params_count; i++, param++)
           ^
   net/core/devlink.c:9839:3: note: Calling 'devlink_param_unregister_one'
                   devlink_param_unregister_one(devlink, 0, param_list, param,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:4804:15: note: Calling 'devlink_param_find_by_name'
           param_item = devlink_param_find_by_name(param_list, param->name);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c:4315:2: note: Left side of '&&' is false
           list_for_each_entry(param_item, param_list, list)
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   net/core/devlink.c:4315:2: note: Taking false branch
           list_for_each_entry(param_item, param_list, list)
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 
'compiletime_assert'

vim +1283 net/core/devlink.c

bfcd3a46617209 Jiri Pirko      2016-02-26  1270  
30335171ca292d Leon Romanovsky 2021-08-08  1271  static int 
devlink_port_type_set(struct devlink_port *devlink_port,
bfcd3a46617209 Jiri Pirko      2016-02-26  1272                                 
 enum devlink_port_type port_type)
bfcd3a46617209 Jiri Pirko      2016-02-26  1273  
bfcd3a46617209 Jiri Pirko      2016-02-26  1274  {
bfcd3a46617209 Jiri Pirko      2016-02-26  1275         int err;
bfcd3a46617209 Jiri Pirko      2016-02-26  1276  
30335171ca292d Leon Romanovsky 2021-08-08  1277         if 
(devlink_port->devlink->ops->port_type_set)
30335171ca292d Leon Romanovsky 2021-08-08  1278                 return 
-EOPNOTSUPP;
30335171ca292d Leon Romanovsky 2021-08-08  1279  
6edf10173a1feb Elad Raz        2016-10-23  1280         if (port_type == 
devlink_port->type)
6edf10173a1feb Elad Raz        2016-10-23  1281                 return 0;
30335171ca292d Leon Romanovsky 2021-08-08  1282  
30335171ca292d Leon Romanovsky 2021-08-08 @1283         err = 
devlink_port->devlink->ops->port_type_set(devlink_port,
30335171ca292d Leon Romanovsky 2021-08-08  1284                                 
                        port_type);
bfcd3a46617209 Jiri Pirko      2016-02-26  1285         if (err)
bfcd3a46617209 Jiri Pirko      2016-02-26  1286                 return err;
30335171ca292d Leon Romanovsky 2021-08-08  1287  
bfcd3a46617209 Jiri Pirko      2016-02-26  1288         
devlink_port->desired_type = port_type;
bfcd3a46617209 Jiri Pirko      2016-02-26  1289         
devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW);
bfcd3a46617209 Jiri Pirko      2016-02-26  1290         return 0;
bfcd3a46617209 Jiri Pirko      2016-02-26  1291  }
bfcd3a46617209 Jiri Pirko      2016-02-26  1292  

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