• Li Wei's avatar
    ipv6: Fix Smatch warning. · 8b2aaede
    Li Wei authored
    With commit d6ddef9e(IPv6: Fix not join all-router mcast group
    when forwarding set.) I check 'dev' after it's dereference that
    leads to a Smatch complaint:
    
    net/ipv6/addrconf.c:438 ipv6_add_dev()
    	 warn: variable dereferenced before check 'dev' (see line 432)
    
    net/ipv6/addrconf.c
       431		/* protected by rtnl_lock */
       432		rcu_assign_pointer(dev->ip6_ptr, ndev);
                                       ^^^^^^^^^^^^
    Old dereference.
    
       433
       434		/* Join all-node multicast group */
       435		ipv6_dev_mc_inc(dev, &in6addr_linklocal_allnodes);
       436
       437		/* Join all-router multicast group if forwarding is set
    */
       438		if (ndev->cnf.forwarding && dev && (dev->flags &
    IFF_MULTICAST))
                                                ^^^
    
    Remove the check to avoid the complaint as 'dev' can't be NULL.
    Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: default avatarLi Wei <lw@cn.fujitsu.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8b2aaede
addrconf.c 116 KB