CC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Joe Perches <[email protected]>
TO: netdev <[email protected]>
CC: Johannes Berg <[email protected]>
CC: Jonathan Toppins <[email protected]>
CC: LKML <[email protected]>

Hi Joe,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on ipvs/master net-next/master linus/master v5.14-rc5 
next-20210810]
[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/Joe-Perches/netlink-NL_SET_ERR_MSG-remove-local-static-array/20210810-010640
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 
d09c548dbf3b31cb07bba562e0f452edfa01efe3
:::::: branch date: 27 hours ago
:::::: commit date: 27 hours ago
config: x86_64-randconfig-c001-20210810 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
614c7d03877fd99c2de47429b15be3f00306a3bd)
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/ba790669ccffc4fb335a699190b2d141f0681910
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Joe-Perches/netlink-NL_SET_ERR_MSG-remove-local-static-array/20210810-010640
        git checkout ba790669ccffc4fb335a699190b2d141f0681910
        # 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 >>)
                              ^
   include/linux/rcupdate.h:528:31: note: expanded from macro 
'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
                                        ^
   net/ipv6/route.c:3067:2: note: Assuming the condition is false
           for_each_fib6_node_rt_rcu(fn) {
           ^
   include/net/ip6_fib.h:233:12: note: expanded from macro 
'for_each_fib6_node_rt_rcu'
           for (rt = rcu_dereference((fn)->leaf); rt;                      \
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:596:28: note: expanded from macro 'rcu_dereference'
   #define rcu_dereference(p) rcu_dereference_check(p, 0)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:528:2: note: expanded from macro 
'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:390:19: note: expanded from macro 
'__rcu_dereference_check'
           RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:318:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
                   if ((c) && debug_lockdep_rcu_enabled() && !__warned) {  \
                        ^
   net/ipv6/route.c:3067:2: note: Left side of '&&' is false
           for_each_fib6_node_rt_rcu(fn) {
           ^
   include/net/ip6_fib.h:233:12: note: expanded from macro 
'for_each_fib6_node_rt_rcu'
           for (rt = rcu_dereference((fn)->leaf); rt;                      \
                     ^
   include/linux/rcupdate.h:596:28: note: expanded from macro 'rcu_dereference'
   #define rcu_dereference(p) rcu_dereference_check(p, 0)
                              ^
   include/linux/rcupdate.h:528:2: note: expanded from macro 
'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:390:2: note: expanded from macro 
'__rcu_dereference_check'
           RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
           ^
   include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
                   if ((c) && debug_lockdep_rcu_enabled() && !__warned) {  \
                           ^
   net/ipv6/route.c:3067:2: note: Loop condition is false.  Exiting loop
           for_each_fib6_node_rt_rcu(fn) {
           ^
   include/net/ip6_fib.h:233:12: note: expanded from macro 
'for_each_fib6_node_rt_rcu'
           for (rt = rcu_dereference((fn)->leaf); rt;                      \
                     ^
   include/linux/rcupdate.h:596:28: note: expanded from macro 'rcu_dereference'
   #define rcu_dereference(p) rcu_dereference_check(p, 0)
                              ^
   include/linux/rcupdate.h:528:2: note: expanded from macro 
'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:390:2: note: expanded from macro 
'__rcu_dereference_check'
           RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
           ^
   include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
           do {                                                            \
           ^
   net/ipv6/route.c:3067:2: note: Loop condition is true.  Entering loop body
           for_each_fib6_node_rt_rcu(fn) {
           ^
   include/net/ip6_fib.h:233:2: note: expanded from macro 
'for_each_fib6_node_rt_rcu'
           for (rt = rcu_dereference((fn)->leaf); rt;                      \
           ^
   net/ipv6/route.c:3069:3: note: Taking false branch
                   if (fib6_check_expired(rt))
                   ^
   net/ipv6/route.c:3071:7: note: Assuming the condition is true
                   if (rt->fib6_flags & RTF_REJECT)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:3071:3: note: Taking true branch
                   if (rt->fib6_flags & RTF_REJECT)
                   ^
   net/ipv6/route.c:3072:4: note:  Execution continues on line 3089
                           break;
                           ^
   net/ipv6/route.c:3089:7: note: 'rt' is non-null
           if (!rt)
                ^~
   net/ipv6/route.c:3089:2: note: Taking false branch
           if (!rt)
           ^
   net/ipv6/route.c:3091:7: note: Taking true branch
           else if (rt->fib6_flags & RTF_REJECT) {
                ^
   net/ipv6/route.c:3093:3: note: Control jumps to line 3105
                   goto out;
                   ^
   net/ipv6/route.c:3105:6: note: Assuming 'ret' is null
           if (ret) {
               ^~~
   net/ipv6/route.c:3105:2: note: Taking false branch
           if (ret) {
           ^
   net/ipv6/route.c:3110:9: note: Calling 'ip6_create_rt_rcu'
                   ret = ip6_create_rt_rcu(&res);
                         ^~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:1174:27: note: Dereference of null pointer
           struct net_device *dev = res->nh->fib_nh_dev;
                                    ^~~~~~~~~~~~~~~~~~~
>> net/ipv6/route.c:3431:9: warning: Dereference of null pointer (loaded from 
>> variable '_dev') [clang-analyzer-core.NullDereference]
                   *_dev = dev = res.nh->fib_nh_dev;
                    ~~~~ ^
   net/ipv6/route.c:3391:27: note: Assuming '_dev' is null
           struct net_device *dev = _dev ? *_dev : NULL;
                                    ^~~~
   net/ipv6/route.c:3391:27: note: '?' condition is false
   net/ipv6/route.c:3396:6: note: Assuming field 'fc_table' is 0
           if (cfg->fc_table) {
               ^~~~~~~~~~~~~
   net/ipv6/route.c:3396:2: note: Taking false branch
           if (cfg->fc_table) {
           ^
   net/ipv6/route.c:3408:6: note: 'err' is < 0
           if (err < 0) {
               ^~~
   net/ipv6/route.c:3408:2: note: Taking true branch
           if (err < 0) {
           ^
   net/ipv6/route.c:3415:7: note: Assuming 'err' is 0
                   if (err || res.fib6_flags & RTF_REJECT ||
                       ^~~
   net/ipv6/route.c:3415:7: note: Left side of '||' is false
   net/ipv6/route.c:3415:14: note: Assuming the condition is false
                   if (err || res.fib6_flags & RTF_REJECT ||
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:3415:7: note: Left side of '||' is false
                   if (err || res.fib6_flags & RTF_REJECT ||
                       ^
   net/ipv6/route.c:3416:7: note: Assuming field 'nhc_gw_family' is 0
                       res.nh->fib_nh_gw_family)
                       ^~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:3415:3: note: Taking false branch
                   if (err || res.fib6_flags & RTF_REJECT ||
                   ^
   net/ipv6/route.c:3419:7: note: 'err' is 0
                   if (err)
                       ^~~
   net/ipv6/route.c:3419:3: note: Taking false branch
                   if (err)
                   ^
   net/ipv6/route.c:3423:6: note: Assuming field 'fc_ifindex' is equal to 0
                                    cfg->fc_ifindex != 0, NULL, flags);
                                    ^~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:3427:6: note: 'dev' is null
           if (dev) {
               ^~~
   net/ipv6/route.c:3427:2: note: Taking false branch
           if (dev) {
           ^
   net/ipv6/route.c:3431:9: note: Dereference of null pointer (loaded from 
variable '_dev')
                   *_dev = dev = res.nh->fib_nh_dev;
                    ~~~~ ^
   net/ipv6/route.c:3638:24: warning: Access to field 'ifindex' results in a 
dereference of a null pointer (loaded from variable 'dev') 
[clang-analyzer-core.NullDereference]
           fib6_nh->fib_nh_oif = dev->ifindex;
                                 ^
   net/ipv6/route.c:5470:8: note: Calling 'rtm_to_fib6_config'
           err = rtm_to_fib6_config(skb, nlh, &cfg, extack);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:5009:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/ipv6/route.c:5009:2: note: Taking false branch
           if (err < 0)
           ^
   net/ipv6/route.c:5028:6: note: Assuming field 'rtm_type' is not equal to 
RTN_UNREACHABLE
           if (rtm->rtm_type == RTN_UNREACHABLE ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:5028:6: note: Left side of '||' is false
   net/ipv6/route.c:5029:6: note: Assuming field 'rtm_type' is not equal to 
RTN_BLACKHOLE
               rtm->rtm_type == RTN_BLACKHOLE ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:5028:6: note: Left side of '||' is false
           if (rtm->rtm_type == RTN_UNREACHABLE ||
               ^
   net/ipv6/route.c:5030:6: note: Assuming field 'rtm_type' is not equal to 
RTN_PROHIBIT
               rtm->rtm_type == RTN_PROHIBIT ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:5028:6: note: Left side of '||' is false
           if (rtm->rtm_type == RTN_UNREACHABLE ||
               ^
   net/ipv6/route.c:5031:6: note: Assuming field 'rtm_type' is not equal to 
RTN_THROW
               rtm->rtm_type == RTN_THROW)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:5028:2: note: Taking false branch
           if (rtm->rtm_type == RTN_UNREACHABLE ||
           ^
   net/ipv6/route.c:5034:6: note: Assuming field 'rtm_type' is not equal to 
RTN_LOCAL
           if (rtm->rtm_type == RTN_LOCAL)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:5034:2: note: Taking false branch
           if (rtm->rtm_type == RTN_LOCAL)
           ^
   net/ipv6/route.c:5037:6: note: Assuming the condition is false
           if (rtm->rtm_flags & RTM_F_CLONED)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/route.c:5037:2: note: Taking false branch
           if (rtm->rtm_flags & RTM_F_CLONED)
           ^
   net/ipv6/route.c:5042:6: note: Assuming the condition is false
           if (tb[RTA_NH_ID]) {

vim +/_dev +3431 net/ipv6/route.c

fc1e64e1092f62 David Ahern 2018-01-25  3384  
1edce99fa8d611 David Ahern 2018-01-25  3385  static int 
ip6_route_check_nh(struct net *net,
1edce99fa8d611 David Ahern 2018-01-25  3386                           struct 
fib6_config *cfg,
1edce99fa8d611 David Ahern 2018-01-25  3387                           struct 
net_device **_dev,
1edce99fa8d611 David Ahern 2018-01-25  3388                           struct 
inet6_dev **idev)
1edce99fa8d611 David Ahern 2018-01-25  3389  {
1edce99fa8d611 David Ahern 2018-01-25  3390     const struct in6_addr *gw_addr 
= &cfg->fc_gateway;
1edce99fa8d611 David Ahern 2018-01-25  3391     struct net_device *dev = _dev ? 
*_dev : NULL;
b2c709cce6826b David Ahern 2019-06-24  3392     int flags = RT6_LOOKUP_F_IFACE;
b2c709cce6826b David Ahern 2019-06-24  3393     struct fib6_result res = {};
1edce99fa8d611 David Ahern 2018-01-25  3394     int err = -EHOSTUNREACH;
1edce99fa8d611 David Ahern 2018-01-25  3395  
1edce99fa8d611 David Ahern 2018-01-25  3396     if (cfg->fc_table) {
b2c709cce6826b David Ahern 2019-06-24  3397             err = 
ip6_nh_lookup_table(net, cfg, gw_addr,
b2c709cce6826b David Ahern 2019-06-24  3398                                     
  cfg->fc_table, flags, &res);
b2c709cce6826b David Ahern 2019-06-24  3399             /* gw_addr can not 
require a gateway or resolve to a reject
b2c709cce6826b David Ahern 2019-06-24  3400              * route. If a device 
is given, it must match the result.
b2c709cce6826b David Ahern 2019-06-24  3401              */
b2c709cce6826b David Ahern 2019-06-24  3402             if (err || 
res.fib6_flags & RTF_REJECT ||
b2c709cce6826b David Ahern 2019-06-24  3403                 
res.nh->fib_nh_gw_family ||
b2c709cce6826b David Ahern 2019-06-24  3404                 (dev && dev != 
res.nh->fib_nh_dev))
b2c709cce6826b David Ahern 2019-06-24  3405                     err = 
-EHOSTUNREACH;
1edce99fa8d611 David Ahern 2018-01-25  3406     }
1edce99fa8d611 David Ahern 2018-01-25  3407  
b2c709cce6826b David Ahern 2019-06-24  3408     if (err < 0) {
b2c709cce6826b David Ahern 2019-06-24  3409             struct flowi6 fl6 = {
b2c709cce6826b David Ahern 2019-06-24  3410                     .flowi6_oif = 
cfg->fc_ifindex,
b2c709cce6826b David Ahern 2019-06-24  3411                     .daddr = 
*gw_addr,
b2c709cce6826b David Ahern 2019-06-24  3412             };
1edce99fa8d611 David Ahern 2018-01-25  3413  
b2c709cce6826b David Ahern 2019-06-24  3414             err = fib6_lookup(net, 
cfg->fc_ifindex, &fl6, &res, flags);
b2c709cce6826b David Ahern 2019-06-24  3415             if (err || 
res.fib6_flags & RTF_REJECT ||
b2c709cce6826b David Ahern 2019-06-24  3416                 
res.nh->fib_nh_gw_family)
b2c709cce6826b David Ahern 2019-06-24  3417                     err = 
-EHOSTUNREACH;
1edce99fa8d611 David Ahern 2018-01-25  3418  
b2c709cce6826b David Ahern 2019-06-24  3419             if (err)
b2c709cce6826b David Ahern 2019-06-24  3420                     return err;
b2c709cce6826b David Ahern 2019-06-24  3421  
b2c709cce6826b David Ahern 2019-06-24  3422             fib6_select_path(net, 
&res, &fl6, cfg->fc_ifindex,
b2c709cce6826b David Ahern 2019-06-24  3423                              
cfg->fc_ifindex != 0, NULL, flags);
1edce99fa8d611 David Ahern 2018-01-25  3424     }
b2c709cce6826b David Ahern 2019-06-24  3425  
b2c709cce6826b David Ahern 2019-06-24  3426     err = 0;
b2c709cce6826b David Ahern 2019-06-24  3427     if (dev) {
b2c709cce6826b David Ahern 2019-06-24  3428             if (dev != 
res.nh->fib_nh_dev)
b2c709cce6826b David Ahern 2019-06-24  3429                     err = 
-EHOSTUNREACH;
1edce99fa8d611 David Ahern 2018-01-25  3430     } else {
b2c709cce6826b David Ahern 2019-06-24 @3431             *_dev = dev = 
res.nh->fib_nh_dev;
1edce99fa8d611 David Ahern 2018-01-25  3432             dev_hold(dev);
b2c709cce6826b David Ahern 2019-06-24  3433             *idev = 
in6_dev_get(dev);
1edce99fa8d611 David Ahern 2018-01-25  3434     }
1edce99fa8d611 David Ahern 2018-01-25  3435  
1edce99fa8d611 David Ahern 2018-01-25  3436     return err;
1edce99fa8d611 David Ahern 2018-01-25  3437  }
1edce99fa8d611 David Ahern 2018-01-25  3438  

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