aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-03-31 13:51:59 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-31 13:51:59 -0400
commit1695fb46eb5880dae70b4940a7d6bdf6e276104d (patch)
treec314553dc093f5226913a247c36c03012f7d22d7
parentbc48878c06028f297e4fdf75be7dda88de050430 (diff)
parent53b24b8f94cb15e38e332db82177cf3f0f4df0c5 (diff)
Merge branch 'ipv6_null'
Ian Morris says: ==================== ipv6: coding style - comparisons with NULL The following patches address some coding style issues only. No functional changes and no changes detected by objdiff. The IPV6 code uses multiple different styles when comparing with NULL (I.e. x == NULL and !x as well as x != NULL and x). Generally the latter form is preferred according to checkpatch and so this changes aligns the code to this style. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/addrconf.c88
-rw-r--r--net/ipv6/addrconf_core.c2
-rw-r--r--net/ipv6/af_inet6.c14
-rw-r--r--net/ipv6/ah6.c2
-rw-r--r--net/ipv6/anycast.c10
-rw-r--r--net/ipv6/datagram.c6
-rw-r--r--net/ipv6/esp6.c2
-rw-r--r--net/ipv6/exthdrs_core.c10
-rw-r--r--net/ipv6/icmp.c13
-rw-r--r--net/ipv6/ip6_fib.c4
-rw-r--r--net/ipv6/ip6_flowlabel.c22
-rw-r--r--net/ipv6/ip6_gre.c14
-rw-r--r--net/ipv6/ip6_input.c2
-rw-r--r--net/ipv6/ip6_offload.c2
-rw-r--r--net/ipv6/ip6_output.c24
-rw-r--r--net/ipv6/ip6_tunnel.c12
-rw-r--r--net/ipv6/ip6_vti.c12
-rw-r--r--net/ipv6/ip6mr.c50
-rw-r--r--net/ipv6/ipv6_sockglue.c10
-rw-r--r--net/ipv6/mcast.c30
-rw-r--r--net/ipv6/ndisc.c20
-rw-r--r--net/ipv6/raw.c14
-rw-r--r--net/ipv6/reassembly.c8
-rw-r--r--net/ipv6/route.c2
-rw-r--r--net/ipv6/sit.c22
-rw-r--r--net/ipv6/sysctl_net_ipv6.c2
-rw-r--r--net/ipv6/tcp_ipv6.c20
-rw-r--r--net/ipv6/udp.c14
-rw-r--r--net/ipv6/xfrm6_policy.c2
29 files changed, 216 insertions, 217 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2660263e1131..e86f7434e3c3 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -334,7 +334,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
334 return ERR_PTR(-EINVAL); 334 return ERR_PTR(-EINVAL);
335 335
336 ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL); 336 ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL);
337 if (ndev == NULL) 337 if (!ndev)
338 return ERR_PTR(err); 338 return ERR_PTR(err);
339 339
340 rwlock_init(&ndev->lock); 340 rwlock_init(&ndev->lock);
@@ -346,7 +346,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
346 ndev->cnf.mtu6 = dev->mtu; 346 ndev->cnf.mtu6 = dev->mtu;
347 ndev->cnf.sysctl = NULL; 347 ndev->cnf.sysctl = NULL;
348 ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl); 348 ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl);
349 if (ndev->nd_parms == NULL) { 349 if (!ndev->nd_parms) {
350 kfree(ndev); 350 kfree(ndev);
351 return ERR_PTR(err); 351 return ERR_PTR(err);
352 } 352 }
@@ -481,7 +481,7 @@ static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
481 481
482 nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct netconfmsg), 482 nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct netconfmsg),
483 flags); 483 flags);
484 if (nlh == NULL) 484 if (!nlh)
485 return -EMSGSIZE; 485 return -EMSGSIZE;
486 486
487 ncm = nlmsg_data(nlh); 487 ncm = nlmsg_data(nlh);
@@ -519,7 +519,7 @@ void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,
519 int err = -ENOBUFS; 519 int err = -ENOBUFS;
520 520
521 skb = nlmsg_new(inet6_netconf_msgsize_devconf(type), GFP_ATOMIC); 521 skb = nlmsg_new(inet6_netconf_msgsize_devconf(type), GFP_ATOMIC);
522 if (skb == NULL) 522 if (!skb)
523 goto errout; 523 goto errout;
524 524
525 err = inet6_netconf_fill_devconf(skb, ifindex, devconf, 0, 0, 525 err = inet6_netconf_fill_devconf(skb, ifindex, devconf, 0, 0,
@@ -574,10 +574,10 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb,
574 break; 574 break;
575 default: 575 default:
576 dev = __dev_get_by_index(net, ifindex); 576 dev = __dev_get_by_index(net, ifindex);
577 if (dev == NULL) 577 if (!dev)
578 goto errout; 578 goto errout;
579 in6_dev = __in6_dev_get(dev); 579 in6_dev = __in6_dev_get(dev);
580 if (in6_dev == NULL) 580 if (!in6_dev)
581 goto errout; 581 goto errout;
582 devconf = &in6_dev->cnf; 582 devconf = &in6_dev->cnf;
583 break; 583 break;
@@ -585,7 +585,7 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb,
585 585
586 err = -ENOBUFS; 586 err = -ENOBUFS;
587 skb = nlmsg_new(inet6_netconf_msgsize_devconf(-1), GFP_ATOMIC); 587 skb = nlmsg_new(inet6_netconf_msgsize_devconf(-1), GFP_ATOMIC);
588 if (skb == NULL) 588 if (!skb)
589 goto errout; 589 goto errout;
590 590
591 err = inet6_netconf_fill_devconf(skb, ifindex, devconf, 591 err = inet6_netconf_fill_devconf(skb, ifindex, devconf,
@@ -854,7 +854,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
854 854
855 ifa = kzalloc(sizeof(struct inet6_ifaddr), GFP_ATOMIC); 855 ifa = kzalloc(sizeof(struct inet6_ifaddr), GFP_ATOMIC);
856 856
857 if (ifa == NULL) { 857 if (!ifa) {
858 ADBG("ipv6_add_addr: malloc failed\n"); 858 ADBG("ipv6_add_addr: malloc failed\n");
859 err = -ENOBUFS; 859 err = -ENOBUFS;
860 goto out; 860 goto out;
@@ -1558,7 +1558,7 @@ int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
1558 : ifp->flags; 1558 : ifp->flags;
1559 if (ipv6_addr_equal(&ifp->addr, addr) && 1559 if (ipv6_addr_equal(&ifp->addr, addr) &&
1560 !(ifp_flags&banned_flags) && 1560 !(ifp_flags&banned_flags) &&
1561 (dev == NULL || ifp->idev->dev == dev || 1561 (!dev || ifp->idev->dev == dev ||
1562 !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) { 1562 !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
1563 rcu_read_unlock_bh(); 1563 rcu_read_unlock_bh();
1564 return 1; 1564 return 1;
@@ -1580,7 +1580,7 @@ static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
1580 if (!net_eq(dev_net(ifp->idev->dev), net)) 1580 if (!net_eq(dev_net(ifp->idev->dev), net))
1581 continue; 1581 continue;
1582 if (ipv6_addr_equal(&ifp->addr, addr)) { 1582 if (ipv6_addr_equal(&ifp->addr, addr)) {
1583 if (dev == NULL || ifp->idev->dev == dev) 1583 if (!dev || ifp->idev->dev == dev)
1584 return true; 1584 return true;
1585 } 1585 }
1586 } 1586 }
@@ -1649,7 +1649,7 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *add
1649 if (!net_eq(dev_net(ifp->idev->dev), net)) 1649 if (!net_eq(dev_net(ifp->idev->dev), net))
1650 continue; 1650 continue;
1651 if (ipv6_addr_equal(&ifp->addr, addr)) { 1651 if (ipv6_addr_equal(&ifp->addr, addr)) {
1652 if (dev == NULL || ifp->idev->dev == dev || 1652 if (!dev || ifp->idev->dev == dev ||
1653 !(ifp->scope&(IFA_LINK|IFA_HOST) || strict)) { 1653 !(ifp->scope&(IFA_LINK|IFA_HOST) || strict)) {
1654 result = ifp; 1654 result = ifp;
1655 in6_ifa_hold(ifp); 1655 in6_ifa_hold(ifp);
@@ -2114,7 +2114,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
2114 struct fib6_table *table; 2114 struct fib6_table *table;
2115 2115
2116 table = fib6_get_table(dev_net(dev), RT6_TABLE_PREFIX); 2116 table = fib6_get_table(dev_net(dev), RT6_TABLE_PREFIX);
2117 if (table == NULL) 2117 if (!table)
2118 return NULL; 2118 return NULL;
2119 2119
2120 read_lock_bh(&table->tb6_lock); 2120 read_lock_bh(&table->tb6_lock);
@@ -2278,7 +2278,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
2278 2278
2279 in6_dev = in6_dev_get(dev); 2279 in6_dev = in6_dev_get(dev);
2280 2280
2281 if (in6_dev == NULL) { 2281 if (!in6_dev) {
2282 net_dbg_ratelimited("addrconf: device %s not configured\n", 2282 net_dbg_ratelimited("addrconf: device %s not configured\n",
2283 dev->name); 2283 dev->name);
2284 return; 2284 return;
@@ -2377,7 +2377,7 @@ ok:
2377 2377
2378 ifp = ipv6_get_ifaddr(net, &addr, dev, 1); 2378 ifp = ipv6_get_ifaddr(net, &addr, dev, 1);
2379 2379
2380 if (ifp == NULL && valid_lft) { 2380 if (!ifp && valid_lft) {
2381 int max_addresses = in6_dev->cnf.max_addresses; 2381 int max_addresses = in6_dev->cnf.max_addresses;
2382 2382
2383#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 2383#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
@@ -2486,7 +2486,7 @@ int addrconf_set_dstaddr(struct net *net, void __user *arg)
2486 dev = __dev_get_by_index(net, ireq.ifr6_ifindex); 2486 dev = __dev_get_by_index(net, ireq.ifr6_ifindex);
2487 2487
2488 err = -ENODEV; 2488 err = -ENODEV;
2489 if (dev == NULL) 2489 if (!dev)
2490 goto err_exit; 2490 goto err_exit;
2491 2491
2492#if IS_ENABLED(CONFIG_IPV6_SIT) 2492#if IS_ENABLED(CONFIG_IPV6_SIT)
@@ -2658,7 +2658,7 @@ static int inet6_addr_del(struct net *net, int ifindex, u32 ifa_flags,
2658 return -ENODEV; 2658 return -ENODEV;
2659 2659
2660 idev = __in6_dev_get(dev); 2660 idev = __in6_dev_get(dev);
2661 if (idev == NULL) 2661 if (!idev)
2662 return -ENXIO; 2662 return -ENXIO;
2663 2663
2664 read_lock_bh(&idev->lock); 2664 read_lock_bh(&idev->lock);
@@ -2810,7 +2810,7 @@ static void init_loopback(struct net_device *dev)
2810 ASSERT_RTNL(); 2810 ASSERT_RTNL();
2811 2811
2812 idev = ipv6_find_idev(dev); 2812 idev = ipv6_find_idev(dev);
2813 if (idev == NULL) { 2813 if (!idev) {
2814 pr_debug("%s: add_dev failed\n", __func__); 2814 pr_debug("%s: add_dev failed\n", __func__);
2815 return; 2815 return;
2816 } 2816 }
@@ -3019,7 +3019,7 @@ static void addrconf_sit_config(struct net_device *dev)
3019 */ 3019 */
3020 3020
3021 idev = ipv6_find_idev(dev); 3021 idev = ipv6_find_idev(dev);
3022 if (idev == NULL) { 3022 if (!idev) {
3023 pr_debug("%s: add_dev failed\n", __func__); 3023 pr_debug("%s: add_dev failed\n", __func__);
3024 return; 3024 return;
3025 } 3025 }
@@ -3044,7 +3044,7 @@ static void addrconf_gre_config(struct net_device *dev)
3044 ASSERT_RTNL(); 3044 ASSERT_RTNL();
3045 3045
3046 idev = ipv6_find_idev(dev); 3046 idev = ipv6_find_idev(dev);
3047 if (idev == NULL) { 3047 if (!idev) {
3048 pr_debug("%s: add_dev failed\n", __func__); 3048 pr_debug("%s: add_dev failed\n", __func__);
3049 return; 3049 return;
3050 } 3050 }
@@ -3241,7 +3241,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
3241 neigh_ifdown(&nd_tbl, dev); 3241 neigh_ifdown(&nd_tbl, dev);
3242 3242
3243 idev = __in6_dev_get(dev); 3243 idev = __in6_dev_get(dev);
3244 if (idev == NULL) 3244 if (!idev)
3245 return -ENODEV; 3245 return -ENODEV;
3246 3246
3247 /* 3247 /*
@@ -3996,7 +3996,7 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
3996 3996
3997 ifm = nlmsg_data(nlh); 3997 ifm = nlmsg_data(nlh);
3998 pfx = extract_addr(tb[IFA_ADDRESS], tb[IFA_LOCAL], &peer_pfx); 3998 pfx = extract_addr(tb[IFA_ADDRESS], tb[IFA_LOCAL], &peer_pfx);
3999 if (pfx == NULL) 3999 if (!pfx)
4000 return -EINVAL; 4000 return -EINVAL;
4001 4001
4002 ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : ifm->ifa_flags; 4002 ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : ifm->ifa_flags;
@@ -4108,7 +4108,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
4108 4108
4109 ifm = nlmsg_data(nlh); 4109 ifm = nlmsg_data(nlh);
4110 pfx = extract_addr(tb[IFA_ADDRESS], tb[IFA_LOCAL], &peer_pfx); 4110 pfx = extract_addr(tb[IFA_ADDRESS], tb[IFA_LOCAL], &peer_pfx);
4111 if (pfx == NULL) 4111 if (!pfx)
4112 return -EINVAL; 4112 return -EINVAL;
4113 4113
4114 if (tb[IFA_CACHEINFO]) { 4114 if (tb[IFA_CACHEINFO]) {
@@ -4123,7 +4123,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
4123 } 4123 }
4124 4124
4125 dev = __dev_get_by_index(net, ifm->ifa_index); 4125 dev = __dev_get_by_index(net, ifm->ifa_index);
4126 if (dev == NULL) 4126 if (!dev)
4127 return -ENODEV; 4127 return -ENODEV;
4128 4128
4129 ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : ifm->ifa_flags; 4129 ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : ifm->ifa_flags;
@@ -4133,7 +4133,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
4133 IFA_F_NOPREFIXROUTE | IFA_F_MCAUTOJOIN; 4133 IFA_F_NOPREFIXROUTE | IFA_F_MCAUTOJOIN;
4134 4134
4135 ifa = ipv6_get_ifaddr(net, pfx, dev, 1); 4135 ifa = ipv6_get_ifaddr(net, pfx, dev, 1);
4136 if (ifa == NULL) { 4136 if (!ifa) {
4137 /* 4137 /*
4138 * It would be best to check for !NLM_F_CREATE here but 4138 * It would be best to check for !NLM_F_CREATE here but
4139 * userspace already relies on not having to provide this. 4139 * userspace already relies on not having to provide this.
@@ -4208,7 +4208,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
4208 u32 preferred, valid; 4208 u32 preferred, valid;
4209 4209
4210 nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct ifaddrmsg), flags); 4210 nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct ifaddrmsg), flags);
4211 if (nlh == NULL) 4211 if (!nlh)
4212 return -EMSGSIZE; 4212 return -EMSGSIZE;
4213 4213
4214 put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope), 4214 put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope),
@@ -4269,7 +4269,7 @@ static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca,
4269 scope = RT_SCOPE_SITE; 4269 scope = RT_SCOPE_SITE;
4270 4270
4271 nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct ifaddrmsg), flags); 4271 nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct ifaddrmsg), flags);
4272 if (nlh == NULL) 4272 if (!nlh)
4273 return -EMSGSIZE; 4273 return -EMSGSIZE;
4274 4274
4275 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex); 4275 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
@@ -4295,7 +4295,7 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca,
4295 scope = RT_SCOPE_SITE; 4295 scope = RT_SCOPE_SITE;
4296 4296
4297 nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct ifaddrmsg), flags); 4297 nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct ifaddrmsg), flags);
4298 if (nlh == NULL) 4298 if (!nlh)
4299 return -EMSGSIZE; 4299 return -EMSGSIZE;
4300 4300
4301 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex); 4301 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
@@ -4468,7 +4468,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh)
4468 goto errout; 4468 goto errout;
4469 4469
4470 addr = extract_addr(tb[IFA_ADDRESS], tb[IFA_LOCAL], &peer); 4470 addr = extract_addr(tb[IFA_ADDRESS], tb[IFA_LOCAL], &peer);
4471 if (addr == NULL) { 4471 if (!addr) {
4472 err = -EINVAL; 4472 err = -EINVAL;
4473 goto errout; 4473 goto errout;
4474 } 4474 }
@@ -4511,7 +4511,7 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
4511 int err = -ENOBUFS; 4511 int err = -ENOBUFS;
4512 4512
4513 skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC); 4513 skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC);
4514 if (skb == NULL) 4514 if (!skb)
4515 goto errout; 4515 goto errout;
4516 4516
4517 err = inet6_fill_ifaddr(skb, ifa, 0, 0, event, 0); 4517 err = inet6_fill_ifaddr(skb, ifa, 0, 0, event, 0);
@@ -4664,24 +4664,24 @@ static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev)
4664 if (nla_put(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci)) 4664 if (nla_put(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci))
4665 goto nla_put_failure; 4665 goto nla_put_failure;
4666 nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32)); 4666 nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32));
4667 if (nla == NULL) 4667 if (!nla)
4668 goto nla_put_failure; 4668 goto nla_put_failure;
4669 ipv6_store_devconf(&idev->cnf, nla_data(nla), nla_len(nla)); 4669 ipv6_store_devconf(&idev->cnf, nla_data(nla), nla_len(nla));
4670 4670
4671 /* XXX - MC not implemented */ 4671 /* XXX - MC not implemented */
4672 4672
4673 nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64)); 4673 nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
4674 if (nla == NULL) 4674 if (!nla)
4675 goto nla_put_failure; 4675 goto nla_put_failure;
4676 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla)); 4676 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
4677 4677
4678 nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * sizeof(u64)); 4678 nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * sizeof(u64));
4679 if (nla == NULL) 4679 if (!nla)
4680 goto nla_put_failure; 4680 goto nla_put_failure;
4681 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, nla_len(nla)); 4681 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, nla_len(nla));
4682 4682
4683 nla = nla_reserve(skb, IFLA_INET6_TOKEN, sizeof(struct in6_addr)); 4683 nla = nla_reserve(skb, IFLA_INET6_TOKEN, sizeof(struct in6_addr));
4684 if (nla == NULL) 4684 if (!nla)
4685 goto nla_put_failure; 4685 goto nla_put_failure;
4686 4686
4687 if (nla_put_u8(skb, IFLA_INET6_ADDR_GEN_MODE, idev->addr_gen_mode)) 4687 if (nla_put_u8(skb, IFLA_INET6_ADDR_GEN_MODE, idev->addr_gen_mode))
@@ -4727,7 +4727,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
4727 4727
4728 ASSERT_RTNL(); 4728 ASSERT_RTNL();
4729 4729
4730 if (token == NULL) 4730 if (!token)
4731 return -EINVAL; 4731 return -EINVAL;
4732 if (ipv6_addr_any(token)) 4732 if (ipv6_addr_any(token))
4733 return -EINVAL; 4733 return -EINVAL;
@@ -4843,7 +4843,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
4843 void *protoinfo; 4843 void *protoinfo;
4844 4844
4845 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*hdr), flags); 4845 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*hdr), flags);
4846 if (nlh == NULL) 4846 if (!nlh)
4847 return -EMSGSIZE; 4847 return -EMSGSIZE;
4848 4848
4849 hdr = nlmsg_data(nlh); 4849 hdr = nlmsg_data(nlh);
@@ -4862,7 +4862,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
4862 nla_put_u32(skb, IFLA_LINK, dev->iflink))) 4862 nla_put_u32(skb, IFLA_LINK, dev->iflink)))
4863 goto nla_put_failure; 4863 goto nla_put_failure;
4864 protoinfo = nla_nest_start(skb, IFLA_PROTINFO); 4864 protoinfo = nla_nest_start(skb, IFLA_PROTINFO);
4865 if (protoinfo == NULL) 4865 if (!protoinfo)
4866 goto nla_put_failure; 4866 goto nla_put_failure;
4867 4867
4868 if (inet6_fill_ifla6_attrs(skb, idev) < 0) 4868 if (inet6_fill_ifla6_attrs(skb, idev) < 0)
@@ -4923,7 +4923,7 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
4923 int err = -ENOBUFS; 4923 int err = -ENOBUFS;
4924 4924
4925 skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC); 4925 skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC);
4926 if (skb == NULL) 4926 if (!skb)
4927 goto errout; 4927 goto errout;
4928 4928
4929 err = inet6_fill_ifinfo(skb, idev, 0, 0, event, 0); 4929 err = inet6_fill_ifinfo(skb, idev, 0, 0, event, 0);
@@ -4956,7 +4956,7 @@ static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
4956 struct prefix_cacheinfo ci; 4956 struct prefix_cacheinfo ci;
4957 4957
4958 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*pmsg), flags); 4958 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*pmsg), flags);
4959 if (nlh == NULL) 4959 if (!nlh)
4960 return -EMSGSIZE; 4960 return -EMSGSIZE;
4961 4961
4962 pmsg = nlmsg_data(nlh); 4962 pmsg = nlmsg_data(nlh);
@@ -4995,7 +4995,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
4995 int err = -ENOBUFS; 4995 int err = -ENOBUFS;
4996 4996
4997 skb = nlmsg_new(inet6_prefix_nlmsg_size(), GFP_ATOMIC); 4997 skb = nlmsg_new(inet6_prefix_nlmsg_size(), GFP_ATOMIC);
4998 if (skb == NULL) 4998 if (!skb)
4999 goto errout; 4999 goto errout;
5000 5000
5001 err = inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0); 5001 err = inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0);
@@ -5596,7 +5596,7 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name,
5596 char path[sizeof("net/ipv6/conf/") + IFNAMSIZ]; 5596 char path[sizeof("net/ipv6/conf/") + IFNAMSIZ];
5597 5597
5598 t = kmemdup(&addrconf_sysctl, sizeof(*t), GFP_KERNEL); 5598 t = kmemdup(&addrconf_sysctl, sizeof(*t), GFP_KERNEL);
5599 if (t == NULL) 5599 if (!t)
5600 goto out; 5600 goto out;
5601 5601
5602 for (i = 0; t->addrconf_vars[i].data; i++) { 5602 for (i = 0; t->addrconf_vars[i].data; i++) {
@@ -5608,7 +5608,7 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name,
5608 snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name); 5608 snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name);
5609 5609
5610 t->sysctl_header = register_net_sysctl(net, path, t->addrconf_vars); 5610 t->sysctl_header = register_net_sysctl(net, path, t->addrconf_vars);
5611 if (t->sysctl_header == NULL) 5611 if (!t->sysctl_header)
5612 goto free; 5612 goto free;
5613 5613
5614 p->sysctl = t; 5614 p->sysctl = t;
@@ -5624,7 +5624,7 @@ static void __addrconf_sysctl_unregister(struct ipv6_devconf *p)
5624{ 5624{
5625 struct addrconf_sysctl_table *t; 5625 struct addrconf_sysctl_table *t;
5626 5626
5627 if (p->sysctl == NULL) 5627 if (!p->sysctl)
5628 return; 5628 return;
5629 5629
5630 t = p->sysctl; 5630 t = p->sysctl;
@@ -5667,11 +5667,11 @@ static int __net_init addrconf_init_net(struct net *net)
5667 struct ipv6_devconf *all, *dflt; 5667 struct ipv6_devconf *all, *dflt;
5668 5668
5669 all = kmemdup(&ipv6_devconf, sizeof(ipv6_devconf), GFP_KERNEL); 5669 all = kmemdup(&ipv6_devconf, sizeof(ipv6_devconf), GFP_KERNEL);
5670 if (all == NULL) 5670 if (!all)
5671 goto err_alloc_all; 5671 goto err_alloc_all;
5672 5672
5673 dflt = kmemdup(&ipv6_devconf_dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL); 5673 dflt = kmemdup(&ipv6_devconf_dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL);
5674 if (dflt == NULL) 5674 if (!dflt)
5675 goto err_alloc_dflt; 5675 goto err_alloc_dflt;
5676 5676
5677 /* these will be inherited by all namespaces */ 5677 /* these will be inherited by all namespaces */
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c
index 98cc4cd570e2..d873ceea86e6 100644
--- a/net/ipv6/addrconf_core.c
+++ b/net/ipv6/addrconf_core.c
@@ -140,7 +140,7 @@ void in6_dev_finish_destroy(struct inet6_dev *idev)
140 struct net_device *dev = idev->dev; 140 struct net_device *dev = idev->dev;
141 141
142 WARN_ON(!list_empty(&idev->addr_list)); 142 WARN_ON(!list_empty(&idev->addr_list));
143 WARN_ON(idev->mc_list != NULL); 143 WARN_ON(idev->mc_list);
144 WARN_ON(timer_pending(&idev->rs_timer)); 144 WARN_ON(timer_pending(&idev->rs_timer));
145 145
146#ifdef NET_REFCNT_DEBUG 146#ifdef NET_REFCNT_DEBUG
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index d8dcc526339e..eef63b394c5a 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -164,11 +164,11 @@ lookup_protocol:
164 answer_flags = answer->flags; 164 answer_flags = answer->flags;
165 rcu_read_unlock(); 165 rcu_read_unlock();
166 166
167 WARN_ON(answer_prot->slab == NULL); 167 WARN_ON(!answer_prot->slab);
168 168
169 err = -ENOBUFS; 169 err = -ENOBUFS;
170 sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot); 170 sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot);
171 if (sk == NULL) 171 if (!sk)
172 goto out; 172 goto out;
173 173
174 sock_init_data(sock, sk); 174 sock_init_data(sock, sk);
@@ -391,7 +391,7 @@ int inet6_release(struct socket *sock)
391{ 391{
392 struct sock *sk = sock->sk; 392 struct sock *sk = sock->sk;
393 393
394 if (sk == NULL) 394 if (!sk)
395 return -EINVAL; 395 return -EINVAL;
396 396
397 /* Free mc lists */ 397 /* Free mc lists */
@@ -413,11 +413,11 @@ void inet6_destroy_sock(struct sock *sk)
413 /* Release rx options */ 413 /* Release rx options */
414 414
415 skb = xchg(&np->pktoptions, NULL); 415 skb = xchg(&np->pktoptions, NULL);
416 if (skb != NULL) 416 if (skb)
417 kfree_skb(skb); 417 kfree_skb(skb);
418 418
419 skb = xchg(&np->rxpmtu, NULL); 419 skb = xchg(&np->rxpmtu, NULL);
420 if (skb != NULL) 420 if (skb)
421 kfree_skb(skb); 421 kfree_skb(skb);
422 422
423 /* Free flowlabels */ 423 /* Free flowlabels */
@@ -426,7 +426,7 @@ void inet6_destroy_sock(struct sock *sk)
426 /* Free tx options */ 426 /* Free tx options */
427 427
428 opt = xchg(&np->opt, NULL); 428 opt = xchg(&np->opt, NULL);
429 if (opt != NULL) 429 if (opt)
430 sock_kfree_s(sk, opt, opt->tot_len); 430 sock_kfree_s(sk, opt, opt->tot_len);
431} 431}
432EXPORT_SYMBOL_GPL(inet6_destroy_sock); 432EXPORT_SYMBOL_GPL(inet6_destroy_sock);
@@ -640,7 +640,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
640 640
641 dst = __sk_dst_check(sk, np->dst_cookie); 641 dst = __sk_dst_check(sk, np->dst_cookie);
642 642
643 if (dst == NULL) { 643 if (!dst) {
644 struct inet_sock *inet = inet_sk(sk); 644 struct inet_sock *inet = inet_sk(sk);
645 struct in6_addr *final_p, final; 645 struct in6_addr *final_p, final;
646 struct flowi6 fl6; 646 struct flowi6 fl6;
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index a6727add2624..ed7d4e3f9c10 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -681,7 +681,7 @@ static int ah6_init_state(struct xfrm_state *x)
681 goto error; 681 goto error;
682 682
683 ahp = kzalloc(sizeof(*ahp), GFP_KERNEL); 683 ahp = kzalloc(sizeof(*ahp), GFP_KERNEL);
684 if (ahp == NULL) 684 if (!ahp)
685 return -ENOMEM; 685 return -ENOMEM;
686 686
687 ahash = crypto_alloc_ahash(x->aalg->alg_name, 0, 0); 687 ahash = crypto_alloc_ahash(x->aalg->alg_name, 0, 0);
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 9e6b0ee563f0..514ac259f543 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -70,7 +70,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
70 return -EINVAL; 70 return -EINVAL;
71 71
72 pac = sock_kmalloc(sk, sizeof(struct ipv6_ac_socklist), GFP_KERNEL); 72 pac = sock_kmalloc(sk, sizeof(struct ipv6_ac_socklist), GFP_KERNEL);
73 if (pac == NULL) 73 if (!pac)
74 return -ENOMEM; 74 return -ENOMEM;
75 pac->acl_next = NULL; 75 pac->acl_next = NULL;
76 pac->acl_addr = *addr; 76 pac->acl_addr = *addr;
@@ -93,7 +93,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
93 } else 93 } else
94 dev = __dev_get_by_index(net, ifindex); 94 dev = __dev_get_by_index(net, ifindex);
95 95
96 if (dev == NULL) { 96 if (!dev) {
97 err = -ENODEV; 97 err = -ENODEV;
98 goto error; 98 goto error;
99 } 99 }
@@ -222,7 +222,7 @@ static struct ifacaddr6 *aca_alloc(struct rt6_info *rt,
222 struct ifacaddr6 *aca; 222 struct ifacaddr6 *aca;
223 223
224 aca = kzalloc(sizeof(*aca), GFP_ATOMIC); 224 aca = kzalloc(sizeof(*aca), GFP_ATOMIC);
225 if (aca == NULL) 225 if (!aca)
226 return NULL; 226 return NULL;
227 227
228 aca->aca_addr = *addr; 228 aca->aca_addr = *addr;
@@ -268,7 +268,7 @@ int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr)
268 goto out; 268 goto out;
269 } 269 }
270 aca = aca_alloc(rt, addr); 270 aca = aca_alloc(rt, addr);
271 if (aca == NULL) { 271 if (!aca) {
272 ip6_rt_put(rt); 272 ip6_rt_put(rt);
273 err = -ENOMEM; 273 err = -ENOMEM;
274 goto out; 274 goto out;
@@ -337,7 +337,7 @@ static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr)
337{ 337{
338 struct inet6_dev *idev = __in6_dev_get(dev); 338 struct inet6_dev *idev = __in6_dev_get(dev);
339 339
340 if (idev == NULL) 340 if (!idev)
341 return -ENODEV; 341 return -ENODEV;
342 return __ipv6_dev_ac_dec(idev, addr); 342 return __ipv6_dev_ac_dec(idev, addr);
343} 343}
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index ace8daca5c83..762a58c772b8 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -71,7 +71,7 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
71 fl6.flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK; 71 fl6.flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK;
72 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { 72 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
73 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 73 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
74 if (flowlabel == NULL) 74 if (!flowlabel)
75 return -EINVAL; 75 return -EINVAL;
76 } 76 }
77 } 77 }
@@ -373,7 +373,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
373 373
374 err = -EAGAIN; 374 err = -EAGAIN;
375 skb = sock_dequeue_err_skb(sk); 375 skb = sock_dequeue_err_skb(sk);
376 if (skb == NULL) 376 if (!skb)
377 goto out; 377 goto out;
378 378
379 copied = skb->len; 379 copied = skb->len;
@@ -463,7 +463,7 @@ int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len,
463 463
464 err = -EAGAIN; 464 err = -EAGAIN;
465 skb = xchg(&np->rxpmtu, NULL); 465 skb = xchg(&np->rxpmtu, NULL);
466 if (skb == NULL) 466 if (!skb)
467 goto out; 467 goto out;
468 468
469 copied = skb->len; 469 copied = skb->len;
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index e48f2c7c5c59..31f1b5d5e2ef 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -495,7 +495,7 @@ static int esp_init_authenc(struct xfrm_state *x)
495 int err; 495 int err;
496 496
497 err = -EINVAL; 497 err = -EINVAL;
498 if (x->ealg == NULL) 498 if (!x->ealg)
499 goto error; 499 goto error;
500 500
501 err = -ENAMETOOLONG; 501 err = -ENAMETOOLONG;
diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index 8af3eb57f438..5c5d23e59da5 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -82,7 +82,7 @@ int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp,
82 if (nexthdr == NEXTHDR_NONE) 82 if (nexthdr == NEXTHDR_NONE)
83 return -1; 83 return -1;
84 hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr); 84 hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr);
85 if (hp == NULL) 85 if (!hp)
86 return -1; 86 return -1;
87 if (nexthdr == NEXTHDR_FRAGMENT) { 87 if (nexthdr == NEXTHDR_FRAGMENT) {
88 __be16 _frag_off, *fp; 88 __be16 _frag_off, *fp;
@@ -91,7 +91,7 @@ int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp,
91 frag_off), 91 frag_off),
92 sizeof(_frag_off), 92 sizeof(_frag_off),
93 &_frag_off); 93 &_frag_off);
94 if (fp == NULL) 94 if (!fp)
95 return -1; 95 return -1;
96 96
97 *frag_offp = *fp; 97 *frag_offp = *fp;
@@ -218,7 +218,7 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
218 } 218 }
219 219
220 hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr); 220 hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr);
221 if (hp == NULL) 221 if (!hp)
222 return -EBADMSG; 222 return -EBADMSG;
223 223
224 if (nexthdr == NEXTHDR_ROUTING) { 224 if (nexthdr == NEXTHDR_ROUTING) {
@@ -226,7 +226,7 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
226 226
227 rh = skb_header_pointer(skb, start, sizeof(_rh), 227 rh = skb_header_pointer(skb, start, sizeof(_rh),
228 &_rh); 228 &_rh);
229 if (rh == NULL) 229 if (!rh)
230 return -EBADMSG; 230 return -EBADMSG;
231 231
232 if (flags && (*flags & IP6_FH_F_SKIP_RH) && 232 if (flags && (*flags & IP6_FH_F_SKIP_RH) &&
@@ -245,7 +245,7 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
245 frag_off), 245 frag_off),
246 sizeof(_frag_off), 246 sizeof(_frag_off),
247 &_frag_off); 247 &_frag_off);
248 if (fp == NULL) 248 if (!fp)
249 return -EBADMSG; 249 return -EBADMSG;
250 250
251 _frag_off = ntohs(*fp) & ~0x7; 251 _frag_off = ntohs(*fp) & ~0x7;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index a5e95199585e..2c2b5d51f15c 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -160,8 +160,7 @@ static bool is_ineligible(const struct sk_buff *skb)
160 tp = skb_header_pointer(skb, 160 tp = skb_header_pointer(skb,
161 ptr+offsetof(struct icmp6hdr, icmp6_type), 161 ptr+offsetof(struct icmp6hdr, icmp6_type),
162 sizeof(_type), &_type); 162 sizeof(_type), &_type);
163 if (tp == NULL || 163 if (!tp || !(*tp & ICMPV6_INFOMSG_MASK))
164 !(*tp & ICMPV6_INFOMSG_MASK))
165 return true; 164 return true;
166 } 165 }
167 return false; 166 return false;
@@ -231,7 +230,7 @@ static bool opt_unrec(struct sk_buff *skb, __u32 offset)
231 230
232 offset += skb_network_offset(skb); 231 offset += skb_network_offset(skb);
233 op = skb_header_pointer(skb, offset, sizeof(_optval), &_optval); 232 op = skb_header_pointer(skb, offset, sizeof(_optval), &_optval);
234 if (op == NULL) 233 if (!op)
235 return true; 234 return true;
236 return (*op & 0xC0) == 0x80; 235 return (*op & 0xC0) == 0x80;
237} 236}
@@ -244,7 +243,7 @@ int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
244 int err = 0; 243 int err = 0;
245 244
246 skb = skb_peek(&sk->sk_write_queue); 245 skb = skb_peek(&sk->sk_write_queue);
247 if (skb == NULL) 246 if (!skb)
248 goto out; 247 goto out;
249 248
250 icmp6h = icmp6_hdr(skb); 249 icmp6h = icmp6_hdr(skb);
@@ -479,7 +478,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
479 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6)); 478 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
480 479
481 sk = icmpv6_xmit_lock(net); 480 sk = icmpv6_xmit_lock(net);
482 if (sk == NULL) 481 if (!sk)
483 return; 482 return;
484 sk->sk_mark = mark; 483 sk->sk_mark = mark;
485 np = inet6_sk(sk); 484 np = inet6_sk(sk);
@@ -582,7 +581,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
582 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6)); 581 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
583 582
584 sk = icmpv6_xmit_lock(net); 583 sk = icmpv6_xmit_lock(net);
585 if (sk == NULL) 584 if (!sk)
586 return; 585 return;
587 sk->sk_mark = mark; 586 sk->sk_mark = mark;
588 np = inet6_sk(sk); 587 np = inet6_sk(sk);
@@ -839,7 +838,7 @@ static int __net_init icmpv6_sk_init(struct net *net)
839 838
840 net->ipv6.icmp_sk = 839 net->ipv6.icmp_sk =
841 kzalloc(nr_cpu_ids * sizeof(struct sock *), GFP_KERNEL); 840 kzalloc(nr_cpu_ids * sizeof(struct sock *), GFP_KERNEL);
842 if (net->ipv6.icmp_sk == NULL) 841 if (!net->ipv6.icmp_sk)
843 return -ENOMEM; 842 return -ENOMEM;
844 843
845 for_each_possible_cpu(i) { 844 for_each_possible_cpu(i) {
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 263ef4143bff..96dbffff5a24 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1206,7 +1206,7 @@ static struct fib6_node *fib6_repair_tree(struct net *net,
1206 1206
1207 WARN_ON(fn->fn_flags & RTN_RTINFO); 1207 WARN_ON(fn->fn_flags & RTN_RTINFO);
1208 WARN_ON(fn->fn_flags & RTN_TL_ROOT); 1208 WARN_ON(fn->fn_flags & RTN_TL_ROOT);
1209 WARN_ON(fn->leaf != NULL); 1209 WARN_ON(fn->leaf);
1210 1210
1211 children = 0; 1211 children = 0;
1212 child = NULL; 1212 child = NULL;
@@ -1361,7 +1361,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info)
1361 1361
1362#if RT6_DEBUG >= 2 1362#if RT6_DEBUG >= 2
1363 if (rt->dst.obsolete > 0) { 1363 if (rt->dst.obsolete > 0) {
1364 WARN_ON(fn != NULL); 1364 WARN_ON(fn);
1365 return -ENOENT; 1365 return -ENOENT;
1366 } 1366 }
1367#endif 1367#endif
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 457303886fd4..d491125011c4 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -205,7 +205,7 @@ static struct ip6_flowlabel *fl_intern(struct net *net,
205 fl->label = htonl(prandom_u32())&IPV6_FLOWLABEL_MASK; 205 fl->label = htonl(prandom_u32())&IPV6_FLOWLABEL_MASK;
206 if (fl->label) { 206 if (fl->label) {
207 lfl = __fl_lookup(net, fl->label); 207 lfl = __fl_lookup(net, fl->label);
208 if (lfl == NULL) 208 if (!lfl)
209 break; 209 break;
210 } 210 }
211 } 211 }
@@ -219,7 +219,7 @@ static struct ip6_flowlabel *fl_intern(struct net *net,
219 * with the same label can only appear on another sock 219 * with the same label can only appear on another sock
220 */ 220 */
221 lfl = __fl_lookup(net, fl->label); 221 lfl = __fl_lookup(net, fl->label);
222 if (lfl != NULL) { 222 if (lfl) {
223 atomic_inc(&lfl->users); 223 atomic_inc(&lfl->users);
224 spin_unlock_bh(&ip6_fl_lock); 224 spin_unlock_bh(&ip6_fl_lock);
225 return lfl; 225 return lfl;
@@ -297,10 +297,10 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
297{ 297{
298 struct ipv6_txoptions *fl_opt = fl->opt; 298 struct ipv6_txoptions *fl_opt = fl->opt;
299 299
300 if (fopt == NULL || fopt->opt_flen == 0) 300 if (!fopt || fopt->opt_flen == 0)
301 return fl_opt; 301 return fl_opt;
302 302
303 if (fl_opt != NULL) { 303 if (fl_opt) {
304 opt_space->hopopt = fl_opt->hopopt; 304 opt_space->hopopt = fl_opt->hopopt;
305 opt_space->dst0opt = fl_opt->dst0opt; 305 opt_space->dst0opt = fl_opt->dst0opt;
306 opt_space->srcrt = fl_opt->srcrt; 306 opt_space->srcrt = fl_opt->srcrt;
@@ -366,7 +366,7 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
366 366
367 err = -ENOMEM; 367 err = -ENOMEM;
368 fl = kzalloc(sizeof(*fl), GFP_KERNEL); 368 fl = kzalloc(sizeof(*fl), GFP_KERNEL);
369 if (fl == NULL) 369 if (!fl)
370 goto done; 370 goto done;
371 371
372 if (olen > 0) { 372 if (olen > 0) {
@@ -376,7 +376,7 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
376 376
377 err = -ENOMEM; 377 err = -ENOMEM;
378 fl->opt = kmalloc(sizeof(*fl->opt) + olen, GFP_KERNEL); 378 fl->opt = kmalloc(sizeof(*fl->opt) + olen, GFP_KERNEL);
379 if (fl->opt == NULL) 379 if (!fl->opt)
380 goto done; 380 goto done;
381 381
382 memset(fl->opt, 0, sizeof(*fl->opt)); 382 memset(fl->opt, 0, sizeof(*fl->opt));
@@ -596,7 +596,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
596 return -EINVAL; 596 return -EINVAL;
597 597
598 fl = fl_create(net, sk, &freq, optval, optlen, &err); 598 fl = fl_create(net, sk, &freq, optval, optlen, &err);
599 if (fl == NULL) 599 if (!fl)
600 return err; 600 return err;
601 sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL); 601 sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL);
602 602
@@ -616,7 +616,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
616 } 616 }
617 rcu_read_unlock_bh(); 617 rcu_read_unlock_bh();
618 618
619 if (fl1 == NULL) 619 if (!fl1)
620 fl1 = fl_lookup(net, freq.flr_label); 620 fl1 = fl_lookup(net, freq.flr_label);
621 if (fl1) { 621 if (fl1) {
622recheck: 622recheck:
@@ -633,7 +633,7 @@ recheck:
633 goto release; 633 goto release;
634 634
635 err = -ENOMEM; 635 err = -ENOMEM;
636 if (sfl1 == NULL) 636 if (!sfl1)
637 goto release; 637 goto release;
638 if (fl->linger > fl1->linger) 638 if (fl->linger > fl1->linger)
639 fl1->linger = fl->linger; 639 fl1->linger = fl->linger;
@@ -653,7 +653,7 @@ release:
653 goto done; 653 goto done;
654 654
655 err = -ENOMEM; 655 err = -ENOMEM;
656 if (sfl1 == NULL) 656 if (!sfl1)
657 goto done; 657 goto done;
658 658
659 err = mem_check(sk); 659 err = mem_check(sk);
@@ -661,7 +661,7 @@ release:
661 goto done; 661 goto done;
662 662
663 fl1 = fl_intern(net, fl, freq.flr_label); 663 fl1 = fl_intern(net, fl, freq.flr_label);
664 if (fl1 != NULL) 664 if (fl1)
665 goto recheck; 665 goto recheck;
666 666
667 if (!freq.flr_label) { 667 if (!freq.flr_label) {
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index bc28b7d42a6d..67e014d88e55 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -223,7 +223,7 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
223 } 223 }
224 } 224 }
225 225
226 if (cand != NULL) 226 if (cand)
227 return cand; 227 return cand;
228 228
229 dev = ign->fb_tunnel_dev; 229 dev = ign->fb_tunnel_dev;
@@ -395,7 +395,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
395 flags & GRE_KEY ? 395 flags & GRE_KEY ?
396 *(((__be32 *)p) + (grehlen / 4) - 1) : 0, 396 *(((__be32 *)p) + (grehlen / 4) - 1) : 0,
397 p[1]); 397 p[1]);
398 if (t == NULL) 398 if (!t)
399 return; 399 return;
400 400
401 switch (type) { 401 switch (type) {
@@ -980,7 +980,7 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu)
980 &p->raddr, &p->laddr, 980 &p->raddr, &p->laddr,
981 p->link, strict); 981 p->link, strict);
982 982
983 if (rt == NULL) 983 if (!rt)
984 return; 984 return;
985 985
986 if (rt->dst.dev) { 986 if (rt->dst.dev) {
@@ -1073,7 +1073,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
1073 } 1073 }
1074 ip6gre_tnl_parm_from_user(&p1, &p); 1074 ip6gre_tnl_parm_from_user(&p1, &p);
1075 t = ip6gre_tunnel_locate(net, &p1, 0); 1075 t = ip6gre_tunnel_locate(net, &p1, 0);
1076 if (t == NULL) 1076 if (!t)
1077 t = netdev_priv(dev); 1077 t = netdev_priv(dev);
1078 } 1078 }
1079 memset(&p, 0, sizeof(p)); 1079 memset(&p, 0, sizeof(p));
@@ -1105,7 +1105,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
1105 t = ip6gre_tunnel_locate(net, &p1, cmd == SIOCADDTUNNEL); 1105 t = ip6gre_tunnel_locate(net, &p1, cmd == SIOCADDTUNNEL);
1106 1106
1107 if (dev != ign->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) { 1107 if (dev != ign->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) {
1108 if (t != NULL) { 1108 if (t) {
1109 if (t->dev != dev) { 1109 if (t->dev != dev) {
1110 err = -EEXIST; 1110 err = -EEXIST;
1111 break; 1111 break;
@@ -1144,7 +1144,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
1144 err = -ENOENT; 1144 err = -ENOENT;
1145 ip6gre_tnl_parm_from_user(&p1, &p); 1145 ip6gre_tnl_parm_from_user(&p1, &p);
1146 t = ip6gre_tunnel_locate(net, &p1, 0); 1146 t = ip6gre_tunnel_locate(net, &p1, 0);
1147 if (t == NULL) 1147 if (!t)
1148 goto done; 1148 goto done;
1149 err = -EPERM; 1149 err = -EPERM;
1150 if (t == netdev_priv(ign->fb_tunnel_dev)) 1150 if (t == netdev_priv(ign->fb_tunnel_dev))
@@ -1313,7 +1313,7 @@ static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head)
1313 1313
1314 t = rtnl_dereference(ign->tunnels[prio][h]); 1314 t = rtnl_dereference(ign->tunnels[prio][h]);
1315 1315
1316 while (t != NULL) { 1316 while (t) {
1317 /* If dev is in the same netns, it has already 1317 /* If dev is in the same netns, it has already
1318 * been added to the list by the previous loop. 1318 * been added to the list by the previous loop.
1319 */ 1319 */
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index aacdcb4dc762..fb97f7f8d4ed 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -221,7 +221,7 @@ resubmit:
221 221
222 raw = raw6_local_deliver(skb, nexthdr); 222 raw = raw6_local_deliver(skb, nexthdr);
223 ipprot = rcu_dereference(inet6_protos[nexthdr]); 223 ipprot = rcu_dereference(inet6_protos[nexthdr]);
224 if (ipprot != NULL) { 224 if (ipprot) {
225 int ret; 225 int ret;
226 226
227 if (ipprot->flags & INET6_PROTO_FINAL) { 227 if (ipprot->flags & INET6_PROTO_FINAL) {
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index 46d452a56d3e..e893cd18612f 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -124,7 +124,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
124 unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr); 124 unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr);
125 fptr = (struct frag_hdr *)((u8 *)ipv6h + unfrag_ip6hlen); 125 fptr = (struct frag_hdr *)((u8 *)ipv6h + unfrag_ip6hlen);
126 fptr->frag_off = htons(offset); 126 fptr->frag_off = htons(offset);
127 if (skb->next != NULL) 127 if (skb->next)
128 fptr->frag_off |= htons(IP6_MF); 128 fptr->frag_off |= htons(IP6_MF);
129 offset += (ntohs(ipv6h->payload_len) - 129 offset += (ntohs(ipv6h->payload_len) -
130 sizeof(struct frag_hdr)); 130 sizeof(struct frag_hdr));
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index b06ad00048d5..84c58da10f5c 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -177,7 +177,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
177 177
178 if (skb_headroom(skb) < head_room) { 178 if (skb_headroom(skb) < head_room) {
179 struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); 179 struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);
180 if (skb2 == NULL) { 180 if (!skb2) {
181 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), 181 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
182 IPSTATS_MIB_OUTDISCARDS); 182 IPSTATS_MIB_OUTDISCARDS);
183 kfree_skb(skb); 183 kfree_skb(skb);
@@ -657,7 +657,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
657 fh->nexthdr = nexthdr; 657 fh->nexthdr = nexthdr;
658 fh->reserved = 0; 658 fh->reserved = 0;
659 fh->frag_off = htons(offset); 659 fh->frag_off = htons(offset);
660 if (frag->next != NULL) 660 if (frag->next)
661 fh->frag_off |= htons(IP6_MF); 661 fh->frag_off |= htons(IP6_MF);
662 fh->identification = frag_id; 662 fh->identification = frag_id;
663 ipv6_hdr(frag)->payload_len = 663 ipv6_hdr(frag)->payload_len =
@@ -823,7 +823,7 @@ static inline int ip6_rt_check(const struct rt6key *rt_key,
823 const struct in6_addr *addr_cache) 823 const struct in6_addr *addr_cache)
824{ 824{
825 return (rt_key->plen != 128 || !ipv6_addr_equal(fl_addr, &rt_key->addr)) && 825 return (rt_key->plen != 128 || !ipv6_addr_equal(fl_addr, &rt_key->addr)) &&
826 (addr_cache == NULL || !ipv6_addr_equal(fl_addr, addr_cache)); 826 (!addr_cache || !ipv6_addr_equal(fl_addr, addr_cache));
827} 827}
828 828
829static struct dst_entry *ip6_sk_dst_check(struct sock *sk, 829static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
@@ -882,7 +882,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
882#endif 882#endif
883 int err; 883 int err;
884 884
885 if (*dst == NULL) 885 if (!*dst)
886 *dst = ip6_route_output(net, sk, fl6); 886 *dst = ip6_route_output(net, sk, fl6);
887 887
888 err = (*dst)->error; 888 err = (*dst)->error;
@@ -1045,11 +1045,11 @@ static inline int ip6_ufo_append_data(struct sock *sk,
1045 * udp datagram 1045 * udp datagram
1046 */ 1046 */
1047 skb = skb_peek_tail(queue); 1047 skb = skb_peek_tail(queue);
1048 if (skb == NULL) { 1048 if (!skb) {
1049 skb = sock_alloc_send_skb(sk, 1049 skb = sock_alloc_send_skb(sk,
1050 hh_len + fragheaderlen + transhdrlen + 20, 1050 hh_len + fragheaderlen + transhdrlen + 20,
1051 (flags & MSG_DONTWAIT), &err); 1051 (flags & MSG_DONTWAIT), &err);
1052 if (skb == NULL) 1052 if (!skb)
1053 return err; 1053 return err;
1054 1054
1055 /* reserve space for Hardware header */ 1055 /* reserve space for Hardware header */
@@ -1107,7 +1107,7 @@ static void ip6_append_data_mtu(unsigned int *mtu,
1107 unsigned int orig_mtu) 1107 unsigned int orig_mtu)
1108{ 1108{
1109 if (!(rt->dst.flags & DST_XFRM_TUNNEL)) { 1109 if (!(rt->dst.flags & DST_XFRM_TUNNEL)) {
1110 if (skb == NULL) { 1110 if (!skb) {
1111 /* first fragment, reserve header_len */ 1111 /* first fragment, reserve header_len */
1112 *mtu = orig_mtu - rt->dst.header_len; 1112 *mtu = orig_mtu - rt->dst.header_len;
1113 1113
@@ -1139,7 +1139,7 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
1139 return -EINVAL; 1139 return -EINVAL;
1140 1140
1141 v6_cork->opt = kzalloc(opt->tot_len, sk->sk_allocation); 1141 v6_cork->opt = kzalloc(opt->tot_len, sk->sk_allocation);
1142 if (unlikely(v6_cork->opt == NULL)) 1142 if (unlikely(!v6_cork->opt))
1143 return -ENOBUFS; 1143 return -ENOBUFS;
1144 1144
1145 v6_cork->opt->tot_len = opt->tot_len; 1145 v6_cork->opt->tot_len = opt->tot_len;
@@ -1331,7 +1331,7 @@ alloc_new_skb:
1331 else 1331 else
1332 fraggap = 0; 1332 fraggap = 0;
1333 /* update mtu and maxfraglen if necessary */ 1333 /* update mtu and maxfraglen if necessary */
1334 if (skb == NULL || skb_prev == NULL) 1334 if (!skb || !skb_prev)
1335 ip6_append_data_mtu(&mtu, &maxfraglen, 1335 ip6_append_data_mtu(&mtu, &maxfraglen,
1336 fragheaderlen, skb, rt, 1336 fragheaderlen, skb, rt,
1337 orig_mtu); 1337 orig_mtu);
@@ -1383,10 +1383,10 @@ alloc_new_skb:
1383 skb = sock_wmalloc(sk, 1383 skb = sock_wmalloc(sk,
1384 alloclen + hh_len, 1, 1384 alloclen + hh_len, 1,
1385 sk->sk_allocation); 1385 sk->sk_allocation);
1386 if (unlikely(skb == NULL)) 1386 if (unlikely(!skb))
1387 err = -ENOBUFS; 1387 err = -ENOBUFS;
1388 } 1388 }
1389 if (skb == NULL) 1389 if (!skb)
1390 goto error; 1390 goto error;
1391 /* 1391 /*
1392 * Fill in the control structures 1392 * Fill in the control structures
@@ -1578,7 +1578,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
1578 unsigned char proto = fl6->flowi6_proto; 1578 unsigned char proto = fl6->flowi6_proto;
1579 1579
1580 skb = __skb_dequeue(queue); 1580 skb = __skb_dequeue(queue);
1581 if (skb == NULL) 1581 if (!skb)
1582 goto out; 1582 goto out;
1583 tail_skb = &(skb_shinfo(skb)->frag_list); 1583 tail_skb = &(skb_shinfo(skb)->frag_list);
1584 1584
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 41f84f76ad9d..0c68012b6d6e 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -131,7 +131,7 @@ struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t)
131 struct dst_entry *dst = t->dst_cache; 131 struct dst_entry *dst = t->dst_cache;
132 132
133 if (dst && dst->obsolete && 133 if (dst && dst->obsolete &&
134 dst->ops->check(dst, t->dst_cookie) == NULL) { 134 !dst->ops->check(dst, t->dst_cookie)) {
135 t->dst_cache = NULL; 135 t->dst_cache = NULL;
136 dst_release(dst); 136 dst_release(dst);
137 return NULL; 137 return NULL;
@@ -325,7 +325,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p)
325 325
326 dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, 326 dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
327 ip6_tnl_dev_setup); 327 ip6_tnl_dev_setup);
328 if (dev == NULL) 328 if (!dev)
329 goto failed; 329 goto failed;
330 330
331 dev_net_set(dev, net); 331 dev_net_set(dev, net);
@@ -496,7 +496,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
496 496
497 rcu_read_lock(); 497 rcu_read_lock();
498 t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->daddr, &ipv6h->saddr); 498 t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->daddr, &ipv6h->saddr);
499 if (t == NULL) 499 if (!t)
500 goto out; 500 goto out;
501 501
502 tproto = ACCESS_ONCE(t->parms.proto); 502 tproto = ACCESS_ONCE(t->parms.proto);
@@ -807,7 +807,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
807 807
808 rcu_read_lock(); 808 rcu_read_lock();
809 t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr); 809 t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr);
810 if (t != NULL) { 810 if (t) {
811 struct pcpu_sw_netstats *tstats; 811 struct pcpu_sw_netstats *tstats;
812 812
813 tproto = ACCESS_ONCE(t->parms.proto); 813 tproto = ACCESS_ONCE(t->parms.proto);
@@ -1274,7 +1274,7 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
1274 &p->raddr, &p->laddr, 1274 &p->raddr, &p->laddr,
1275 p->link, strict); 1275 p->link, strict);
1276 1276
1277 if (rt == NULL) 1277 if (!rt)
1278 return; 1278 return;
1279 1279
1280 if (rt->dst.dev) { 1280 if (rt->dst.dev) {
@@ -1815,7 +1815,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct net *net)
1815 1815
1816 for (h = 0; h < HASH_SIZE; h++) { 1816 for (h = 0; h < HASH_SIZE; h++) {
1817 t = rtnl_dereference(ip6n->tnls_r_l[h]); 1817 t = rtnl_dereference(ip6n->tnls_r_l[h]);
1818 while (t != NULL) { 1818 while (t) {
1819 /* If dev is in the same netns, it has already 1819 /* If dev is in the same netns, it has already
1820 * been added to the list by the previous loop. 1820 * been added to the list by the previous loop.
1821 */ 1821 */
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 5fb9e212eca8..1ec5b4a530d0 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -218,7 +218,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p
218 sprintf(name, "ip6_vti%%d"); 218 sprintf(name, "ip6_vti%%d");
219 219
220 dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, vti6_dev_setup); 220 dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, vti6_dev_setup);
221 if (dev == NULL) 221 if (!dev)
222 goto failed; 222 goto failed;
223 223
224 dev_net_set(dev, net); 224 dev_net_set(dev, net);
@@ -305,7 +305,7 @@ static int vti6_rcv(struct sk_buff *skb)
305 305
306 rcu_read_lock(); 306 rcu_read_lock();
307 t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr); 307 t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr);
308 if (t != NULL) { 308 if (t) {
309 if (t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) { 309 if (t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) {
310 rcu_read_unlock(); 310 rcu_read_unlock();
311 goto discard; 311 goto discard;
@@ -716,7 +716,7 @@ vti6_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
716 } else { 716 } else {
717 memset(&p, 0, sizeof(p)); 717 memset(&p, 0, sizeof(p));
718 } 718 }
719 if (t == NULL) 719 if (!t)
720 t = netdev_priv(dev); 720 t = netdev_priv(dev);
721 vti6_parm_to_user(&p, &t->parms); 721 vti6_parm_to_user(&p, &t->parms);
722 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 722 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
@@ -736,7 +736,7 @@ vti6_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
736 vti6_parm_from_user(&p1, &p); 736 vti6_parm_from_user(&p1, &p);
737 t = vti6_locate(net, &p1, cmd == SIOCADDTUNNEL); 737 t = vti6_locate(net, &p1, cmd == SIOCADDTUNNEL);
738 if (dev != ip6n->fb_tnl_dev && cmd == SIOCCHGTUNNEL) { 738 if (dev != ip6n->fb_tnl_dev && cmd == SIOCCHGTUNNEL) {
739 if (t != NULL) { 739 if (t) {
740 if (t->dev != dev) { 740 if (t->dev != dev) {
741 err = -EEXIST; 741 err = -EEXIST;
742 break; 742 break;
@@ -767,7 +767,7 @@ vti6_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
767 err = -ENOENT; 767 err = -ENOENT;
768 vti6_parm_from_user(&p1, &p); 768 vti6_parm_from_user(&p1, &p);
769 t = vti6_locate(net, &p1, 0); 769 t = vti6_locate(net, &p1, 0);
770 if (t == NULL) 770 if (!t)
771 break; 771 break;
772 err = -EPERM; 772 err = -EPERM;
773 if (t->dev == ip6n->fb_tnl_dev) 773 if (t->dev == ip6n->fb_tnl_dev)
@@ -1027,7 +1027,7 @@ static void __net_exit vti6_destroy_tunnels(struct vti6_net *ip6n)
1027 1027
1028 for (h = 0; h < HASH_SIZE; h++) { 1028 for (h = 0; h < HASH_SIZE; h++) {
1029 t = rtnl_dereference(ip6n->tnls_r_l[h]); 1029 t = rtnl_dereference(ip6n->tnls_r_l[h]);
1030 while (t != NULL) { 1030 while (t) {
1031 unregister_netdevice_queue(t->dev, &list); 1031 unregister_netdevice_queue(t->dev, &list);
1032 t = rtnl_dereference(t->next); 1032 t = rtnl_dereference(t->next);
1033 } 1033 }
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 4b9315aa273e..ff883c9d0e3c 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -173,7 +173,7 @@ static int ip6mr_rule_action(struct fib_rule *rule, struct flowi *flp,
173 } 173 }
174 174
175 mrt = ip6mr_get_table(rule->fr_net, rule->table); 175 mrt = ip6mr_get_table(rule->fr_net, rule->table);
176 if (mrt == NULL) 176 if (!mrt)
177 return -EAGAIN; 177 return -EAGAIN;
178 res->mrt = mrt; 178 res->mrt = mrt;
179 return 0; 179 return 0;
@@ -237,7 +237,7 @@ static int __net_init ip6mr_rules_init(struct net *net)
237 INIT_LIST_HEAD(&net->ipv6.mr6_tables); 237 INIT_LIST_HEAD(&net->ipv6.mr6_tables);
238 238
239 mrt = ip6mr_new_table(net, RT6_TABLE_DFLT); 239 mrt = ip6mr_new_table(net, RT6_TABLE_DFLT);
240 if (mrt == NULL) { 240 if (!mrt) {
241 err = -ENOMEM; 241 err = -ENOMEM;
242 goto err1; 242 goto err1;
243 } 243 }
@@ -305,11 +305,11 @@ static struct mr6_table *ip6mr_new_table(struct net *net, u32 id)
305 unsigned int i; 305 unsigned int i;
306 306
307 mrt = ip6mr_get_table(net, id); 307 mrt = ip6mr_get_table(net, id);
308 if (mrt != NULL) 308 if (mrt)
309 return mrt; 309 return mrt;
310 310
311 mrt = kzalloc(sizeof(*mrt), GFP_KERNEL); 311 mrt = kzalloc(sizeof(*mrt), GFP_KERNEL);
312 if (mrt == NULL) 312 if (!mrt)
313 return NULL; 313 return NULL;
314 mrt->id = id; 314 mrt->id = id;
315 write_pnet(&mrt->net, net); 315 write_pnet(&mrt->net, net);
@@ -408,7 +408,7 @@ static void *ip6mr_vif_seq_start(struct seq_file *seq, loff_t *pos)
408 struct mr6_table *mrt; 408 struct mr6_table *mrt;
409 409
410 mrt = ip6mr_get_table(net, RT6_TABLE_DFLT); 410 mrt = ip6mr_get_table(net, RT6_TABLE_DFLT);
411 if (mrt == NULL) 411 if (!mrt)
412 return ERR_PTR(-ENOENT); 412 return ERR_PTR(-ENOENT);
413 413
414 iter->mrt = mrt; 414 iter->mrt = mrt;
@@ -492,7 +492,7 @@ static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos)
492 struct mr6_table *mrt; 492 struct mr6_table *mrt;
493 493
494 mrt = ip6mr_get_table(net, RT6_TABLE_DFLT); 494 mrt = ip6mr_get_table(net, RT6_TABLE_DFLT);
495 if (mrt == NULL) 495 if (!mrt)
496 return ERR_PTR(-ENOENT); 496 return ERR_PTR(-ENOENT);
497 497
498 it->mrt = mrt; 498 it->mrt = mrt;
@@ -665,7 +665,7 @@ static int pim6_rcv(struct sk_buff *skb)
665 dev_hold(reg_dev); 665 dev_hold(reg_dev);
666 read_unlock(&mrt_lock); 666 read_unlock(&mrt_lock);
667 667
668 if (reg_dev == NULL) 668 if (!reg_dev)
669 goto drop; 669 goto drop;
670 670
671 skb->mac_header = skb->network_header; 671 skb->mac_header = skb->network_header;
@@ -743,7 +743,7 @@ static struct net_device *ip6mr_reg_vif(struct net *net, struct mr6_table *mrt)
743 sprintf(name, "pim6reg%u", mrt->id); 743 sprintf(name, "pim6reg%u", mrt->id);
744 744
745 dev = alloc_netdev(0, name, NET_NAME_UNKNOWN, reg_vif_setup); 745 dev = alloc_netdev(0, name, NET_NAME_UNKNOWN, reg_vif_setup);
746 if (dev == NULL) 746 if (!dev)
747 return NULL; 747 return NULL;
748 748
749 dev_net_set(dev, net); 749 dev_net_set(dev, net);
@@ -1072,7 +1072,7 @@ skip:
1072static struct mfc6_cache *ip6mr_cache_alloc(void) 1072static struct mfc6_cache *ip6mr_cache_alloc(void)
1073{ 1073{
1074 struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); 1074 struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
1075 if (c == NULL) 1075 if (!c)
1076 return NULL; 1076 return NULL;
1077 c->mfc_un.res.minvif = MAXMIFS; 1077 c->mfc_un.res.minvif = MAXMIFS;
1078 return c; 1078 return c;
@@ -1081,7 +1081,7 @@ static struct mfc6_cache *ip6mr_cache_alloc(void)
1081static struct mfc6_cache *ip6mr_cache_alloc_unres(void) 1081static struct mfc6_cache *ip6mr_cache_alloc_unres(void)
1082{ 1082{
1083 struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC); 1083 struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC);
1084 if (c == NULL) 1084 if (!c)
1085 return NULL; 1085 return NULL;
1086 skb_queue_head_init(&c->mfc_un.unres.unresolved); 1086 skb_queue_head_init(&c->mfc_un.unres.unresolved);
1087 c->mfc_un.unres.expires = jiffies + 10 * HZ; 1087 c->mfc_un.unres.expires = jiffies + 10 * HZ;
@@ -1198,7 +1198,7 @@ static int ip6mr_cache_report(struct mr6_table *mrt, struct sk_buff *pkt,
1198 skb->ip_summed = CHECKSUM_UNNECESSARY; 1198 skb->ip_summed = CHECKSUM_UNNECESSARY;
1199 } 1199 }
1200 1200
1201 if (mrt->mroute6_sk == NULL) { 1201 if (!mrt->mroute6_sk) {
1202 kfree_skb(skb); 1202 kfree_skb(skb);
1203 return -EINVAL; 1203 return -EINVAL;
1204 } 1204 }
@@ -1493,7 +1493,7 @@ static int ip6mr_mfc_add(struct net *net, struct mr6_table *mrt,
1493 return -EINVAL; 1493 return -EINVAL;
1494 1494
1495 c = ip6mr_cache_alloc(); 1495 c = ip6mr_cache_alloc();
1496 if (c == NULL) 1496 if (!c)
1497 return -ENOMEM; 1497 return -ENOMEM;
1498 1498
1499 c->mf6c_origin = mfc->mf6cc_origin.sin6_addr; 1499 c->mf6c_origin = mfc->mf6cc_origin.sin6_addr;
@@ -1663,7 +1663,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
1663 struct mr6_table *mrt; 1663 struct mr6_table *mrt;
1664 1664
1665 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); 1665 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
1666 if (mrt == NULL) 1666 if (!mrt)
1667 return -ENOENT; 1667 return -ENOENT;
1668 1668
1669 if (optname != MRT6_INIT) { 1669 if (optname != MRT6_INIT) {
@@ -1812,7 +1812,7 @@ int ip6_mroute_getsockopt(struct sock *sk, int optname, char __user *optval,
1812 struct mr6_table *mrt; 1812 struct mr6_table *mrt;
1813 1813
1814 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); 1814 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
1815 if (mrt == NULL) 1815 if (!mrt)
1816 return -ENOENT; 1816 return -ENOENT;
1817 1817
1818 switch (optname) { 1818 switch (optname) {
@@ -1859,7 +1859,7 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
1859 struct mr6_table *mrt; 1859 struct mr6_table *mrt;
1860 1860
1861 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); 1861 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
1862 if (mrt == NULL) 1862 if (!mrt)
1863 return -ENOENT; 1863 return -ENOENT;
1864 1864
1865 switch (cmd) { 1865 switch (cmd) {
@@ -1933,7 +1933,7 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
1933 struct mr6_table *mrt; 1933 struct mr6_table *mrt;
1934 1934
1935 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); 1935 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
1936 if (mrt == NULL) 1936 if (!mrt)
1937 return -ENOENT; 1937 return -ENOENT;
1938 1938
1939 switch (cmd) { 1939 switch (cmd) {
@@ -2003,7 +2003,7 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
2003 struct dst_entry *dst; 2003 struct dst_entry *dst;
2004 struct flowi6 fl6; 2004 struct flowi6 fl6;
2005 2005
2006 if (vif->dev == NULL) 2006 if (!vif->dev)
2007 goto out_free; 2007 goto out_free;
2008 2008
2009#ifdef CONFIG_IPV6_PIMSM_V2 2009#ifdef CONFIG_IPV6_PIMSM_V2
@@ -2192,7 +2192,7 @@ int ip6_mr_input(struct sk_buff *skb)
2192 read_lock(&mrt_lock); 2192 read_lock(&mrt_lock);
2193 cache = ip6mr_cache_find(mrt, 2193 cache = ip6mr_cache_find(mrt,
2194 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr); 2194 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr);
2195 if (cache == NULL) { 2195 if (!cache) {
2196 int vif = ip6mr_find_vif(mrt, skb->dev); 2196 int vif = ip6mr_find_vif(mrt, skb->dev);
2197 2197
2198 if (vif >= 0) 2198 if (vif >= 0)
@@ -2204,7 +2204,7 @@ int ip6_mr_input(struct sk_buff *skb)
2204 /* 2204 /*
2205 * No usable cache entry 2205 * No usable cache entry
2206 */ 2206 */
2207 if (cache == NULL) { 2207 if (!cache) {
2208 int vif; 2208 int vif;
2209 2209
2210 vif = ip6mr_find_vif(mrt, skb->dev); 2210 vif = ip6mr_find_vif(mrt, skb->dev);
@@ -2243,13 +2243,13 @@ static int __ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb,
2243 nla_put_u32(skb, RTA_IIF, mrt->vif6_table[c->mf6c_parent].dev->ifindex) < 0) 2243 nla_put_u32(skb, RTA_IIF, mrt->vif6_table[c->mf6c_parent].dev->ifindex) < 0)
2244 return -EMSGSIZE; 2244 return -EMSGSIZE;
2245 mp_attr = nla_nest_start(skb, RTA_MULTIPATH); 2245 mp_attr = nla_nest_start(skb, RTA_MULTIPATH);
2246 if (mp_attr == NULL) 2246 if (!mp_attr)
2247 return -EMSGSIZE; 2247 return -EMSGSIZE;
2248 2248
2249 for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { 2249 for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) {
2250 if (MIF_EXISTS(mrt, ct) && c->mfc_un.res.ttls[ct] < 255) { 2250 if (MIF_EXISTS(mrt, ct) && c->mfc_un.res.ttls[ct] < 255) {
2251 nhp = nla_reserve_nohdr(skb, sizeof(*nhp)); 2251 nhp = nla_reserve_nohdr(skb, sizeof(*nhp));
2252 if (nhp == NULL) { 2252 if (!nhp) {
2253 nla_nest_cancel(skb, mp_attr); 2253 nla_nest_cancel(skb, mp_attr);
2254 return -EMSGSIZE; 2254 return -EMSGSIZE;
2255 } 2255 }
@@ -2282,7 +2282,7 @@ int ip6mr_get_route(struct net *net,
2282 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb); 2282 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
2283 2283
2284 mrt = ip6mr_get_table(net, RT6_TABLE_DFLT); 2284 mrt = ip6mr_get_table(net, RT6_TABLE_DFLT);
2285 if (mrt == NULL) 2285 if (!mrt)
2286 return -ENOENT; 2286 return -ENOENT;
2287 2287
2288 read_lock(&mrt_lock); 2288 read_lock(&mrt_lock);
@@ -2307,7 +2307,7 @@ int ip6mr_get_route(struct net *net,
2307 } 2307 }
2308 2308
2309 dev = skb->dev; 2309 dev = skb->dev;
2310 if (dev == NULL || (vif = ip6mr_find_vif(mrt, dev)) < 0) { 2310 if (!dev || (vif = ip6mr_find_vif(mrt, dev)) < 0) {
2311 read_unlock(&mrt_lock); 2311 read_unlock(&mrt_lock);
2312 return -ENODEV; 2312 return -ENODEV;
2313 } 2313 }
@@ -2359,7 +2359,7 @@ static int ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb,
2359 int err; 2359 int err;
2360 2360
2361 nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), flags); 2361 nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), flags);
2362 if (nlh == NULL) 2362 if (!nlh)
2363 return -EMSGSIZE; 2363 return -EMSGSIZE;
2364 2364
2365 rtm = nlmsg_data(nlh); 2365 rtm = nlmsg_data(nlh);
@@ -2424,7 +2424,7 @@ static void mr6_netlink_event(struct mr6_table *mrt, struct mfc6_cache *mfc,
2424 2424
2425 skb = nlmsg_new(mr6_msgsize(mfc->mf6c_parent >= MAXMIFS, mrt->maxvif), 2425 skb = nlmsg_new(mr6_msgsize(mfc->mf6c_parent >= MAXMIFS, mrt->maxvif),
2426 GFP_ATOMIC); 2426 GFP_ATOMIC);
2427 if (skb == NULL) 2427 if (!skb)
2428 goto errout; 2428 goto errout;
2429 2429
2430 err = ip6mr_fill_mroute(mrt, skb, 0, 0, mfc, cmd, 0); 2430 err = ip6mr_fill_mroute(mrt, skb, 0, 0, mfc, cmd, 0);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 9b2cb1444230..63e6956917c9 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -85,7 +85,7 @@ int ip6_ra_control(struct sock *sk, int sel)
85 return 0; 85 return 0;
86 } 86 }
87 } 87 }
88 if (new_ra == NULL) { 88 if (!new_ra) {
89 write_unlock_bh(&ip6_ra_lock); 89 write_unlock_bh(&ip6_ra_lock);
90 return -ENOBUFS; 90 return -ENOBUFS;
91 } 91 }
@@ -145,7 +145,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
145 int retv = -ENOPROTOOPT; 145 int retv = -ENOPROTOOPT;
146 bool needs_rtnl = setsockopt_needs_rtnl(optname); 146 bool needs_rtnl = setsockopt_needs_rtnl(optname);
147 147
148 if (optval == NULL) 148 if (!optval)
149 val = 0; 149 val = 0;
150 else { 150 else {
151 if (optlen >= sizeof(int)) { 151 if (optlen >= sizeof(int)) {
@@ -392,7 +392,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
392 */ 392 */
393 if (optlen == 0) 393 if (optlen == 0)
394 optval = NULL; 394 optval = NULL;
395 else if (optval == NULL) 395 else if (!optval)
396 goto e_inval; 396 goto e_inval;
397 else if (optlen < sizeof(struct ipv6_opt_hdr) || 397 else if (optlen < sizeof(struct ipv6_opt_hdr) ||
398 optlen & 0x7 || optlen > 8 * 255) 398 optlen & 0x7 || optlen > 8 * 255)
@@ -443,7 +443,7 @@ sticky_done:
443 443
444 if (optlen == 0) 444 if (optlen == 0)
445 goto e_inval; 445 goto e_inval;
446 else if (optlen < sizeof(struct in6_pktinfo) || optval == NULL) 446 else if (optlen < sizeof(struct in6_pktinfo) || !optval)
447 goto e_inval; 447 goto e_inval;
448 448
449 if (copy_from_user(&pkt, optval, sizeof(struct in6_pktinfo))) { 449 if (copy_from_user(&pkt, optval, sizeof(struct in6_pktinfo))) {
@@ -482,7 +482,7 @@ sticky_done:
482 482
483 opt = sock_kmalloc(sk, sizeof(*opt) + optlen, GFP_KERNEL); 483 opt = sock_kmalloc(sk, sizeof(*opt) + optlen, GFP_KERNEL);
484 retv = -ENOBUFS; 484 retv = -ENOBUFS;
485 if (opt == NULL) 485 if (!opt)
486 break; 486 break;
487 487
488 memset(opt, 0, sizeof(*opt)); 488 memset(opt, 0, sizeof(*opt));
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index cbb66fd3da6d..fac1f27e428e 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -157,7 +157,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
157 157
158 mc_lst = sock_kmalloc(sk, sizeof(struct ipv6_mc_socklist), GFP_KERNEL); 158 mc_lst = sock_kmalloc(sk, sizeof(struct ipv6_mc_socklist), GFP_KERNEL);
159 159
160 if (mc_lst == NULL) 160 if (!mc_lst)
161 return -ENOMEM; 161 return -ENOMEM;
162 162
163 mc_lst->next = NULL; 163 mc_lst->next = NULL;
@@ -173,7 +173,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
173 } else 173 } else
174 dev = __dev_get_by_index(net, ifindex); 174 dev = __dev_get_by_index(net, ifindex);
175 175
176 if (dev == NULL) { 176 if (!dev) {
177 sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); 177 sock_kfree_s(sk, mc_lst, sizeof(*mc_lst));
178 return -ENODEV; 178 return -ENODEV;
179 } 179 }
@@ -226,7 +226,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
226 *lnk = mc_lst->next; 226 *lnk = mc_lst->next;
227 227
228 dev = __dev_get_by_index(net, mc_lst->ifindex); 228 dev = __dev_get_by_index(net, mc_lst->ifindex);
229 if (dev != NULL) { 229 if (dev) {
230 struct inet6_dev *idev = __in6_dev_get(dev); 230 struct inet6_dev *idev = __in6_dev_get(dev);
231 231
232 (void) ip6_mc_leave_src(sk, mc_lst, idev); 232 (void) ip6_mc_leave_src(sk, mc_lst, idev);
@@ -823,7 +823,7 @@ static struct ifmcaddr6 *mca_alloc(struct inet6_dev *idev,
823 struct ifmcaddr6 *mc; 823 struct ifmcaddr6 *mc;
824 824
825 mc = kzalloc(sizeof(*mc), GFP_ATOMIC); 825 mc = kzalloc(sizeof(*mc), GFP_ATOMIC);
826 if (mc == NULL) 826 if (!mc)
827 return NULL; 827 return NULL;
828 828
829 setup_timer(&mc->mca_timer, igmp6_timer_handler, (unsigned long)mc); 829 setup_timer(&mc->mca_timer, igmp6_timer_handler, (unsigned long)mc);
@@ -860,7 +860,7 @@ int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr)
860 /* we need to take a reference on idev */ 860 /* we need to take a reference on idev */
861 idev = in6_dev_get(dev); 861 idev = in6_dev_get(dev);
862 862
863 if (idev == NULL) 863 if (!idev)
864 return -EINVAL; 864 return -EINVAL;
865 865
866 write_lock_bh(&idev->lock); 866 write_lock_bh(&idev->lock);
@@ -1328,7 +1328,7 @@ int igmp6_event_query(struct sk_buff *skb)
1328 return -EINVAL; 1328 return -EINVAL;
1329 1329
1330 idev = __in6_dev_get(skb->dev); 1330 idev = __in6_dev_get(skb->dev);
1331 if (idev == NULL) 1331 if (!idev)
1332 return 0; 1332 return 0;
1333 1333
1334 mld = (struct mld_msg *)icmp6_hdr(skb); 1334 mld = (struct mld_msg *)icmp6_hdr(skb);
@@ -1443,7 +1443,7 @@ int igmp6_event_report(struct sk_buff *skb)
1443 return -EINVAL; 1443 return -EINVAL;
1444 1444
1445 idev = __in6_dev_get(skb->dev); 1445 idev = __in6_dev_get(skb->dev);
1446 if (idev == NULL) 1446 if (!idev)
1447 return -ENODEV; 1447 return -ENODEV;
1448 1448
1449 /* 1449 /*
@@ -1962,7 +1962,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1962 1962
1963 skb = sock_alloc_send_skb(sk, hlen + tlen + full_len, 1, &err); 1963 skb = sock_alloc_send_skb(sk, hlen + tlen + full_len, 1, &err);
1964 1964
1965 if (skb == NULL) { 1965 if (!skb) {
1966 rcu_read_lock(); 1966 rcu_read_lock();
1967 IP6_INC_STATS(net, __in6_dev_get(dev), 1967 IP6_INC_STATS(net, __in6_dev_get(dev),
1968 IPSTATS_MIB_OUTDISCARDS); 1968 IPSTATS_MIB_OUTDISCARDS);
@@ -2611,7 +2611,7 @@ static struct ifmcaddr6 *igmp6_mc_get_next(struct seq_file *seq, struct ifmcaddr
2611 2611
2612 im = im->next; 2612 im = im->next;
2613 while (!im) { 2613 while (!im) {
2614 if (likely(state->idev != NULL)) 2614 if (likely(state->idev))
2615 read_unlock_bh(&state->idev->lock); 2615 read_unlock_bh(&state->idev->lock);
2616 2616
2617 state->dev = next_net_device_rcu(state->dev); 2617 state->dev = next_net_device_rcu(state->dev);
@@ -2657,7 +2657,7 @@ static void igmp6_mc_seq_stop(struct seq_file *seq, void *v)
2657{ 2657{
2658 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2658 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2659 2659
2660 if (likely(state->idev != NULL)) { 2660 if (likely(state->idev)) {
2661 read_unlock_bh(&state->idev->lock); 2661 read_unlock_bh(&state->idev->lock);
2662 state->idev = NULL; 2662 state->idev = NULL;
2663 } 2663 }
@@ -2726,10 +2726,10 @@ static inline struct ip6_sf_list *igmp6_mcf_get_first(struct seq_file *seq)
2726 continue; 2726 continue;
2727 read_lock_bh(&idev->lock); 2727 read_lock_bh(&idev->lock);
2728 im = idev->mc_list; 2728 im = idev->mc_list;
2729 if (likely(im != NULL)) { 2729 if (likely(im)) {
2730 spin_lock_bh(&im->mca_lock); 2730 spin_lock_bh(&im->mca_lock);
2731 psf = im->mca_sources; 2731 psf = im->mca_sources;
2732 if (likely(psf != NULL)) { 2732 if (likely(psf)) {
2733 state->im = im; 2733 state->im = im;
2734 state->idev = idev; 2734 state->idev = idev;
2735 break; 2735 break;
@@ -2750,7 +2750,7 @@ static struct ip6_sf_list *igmp6_mcf_get_next(struct seq_file *seq, struct ip6_s
2750 spin_unlock_bh(&state->im->mca_lock); 2750 spin_unlock_bh(&state->im->mca_lock);
2751 state->im = state->im->next; 2751 state->im = state->im->next;
2752 while (!state->im) { 2752 while (!state->im) {
2753 if (likely(state->idev != NULL)) 2753 if (likely(state->idev))
2754 read_unlock_bh(&state->idev->lock); 2754 read_unlock_bh(&state->idev->lock);
2755 2755
2756 state->dev = next_net_device_rcu(state->dev); 2756 state->dev = next_net_device_rcu(state->dev);
@@ -2804,11 +2804,11 @@ static void igmp6_mcf_seq_stop(struct seq_file *seq, void *v)
2804 __releases(RCU) 2804 __releases(RCU)
2805{ 2805{
2806 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); 2806 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
2807 if (likely(state->im != NULL)) { 2807 if (likely(state->im)) {
2808 spin_unlock_bh(&state->im->mca_lock); 2808 spin_unlock_bh(&state->im->mca_lock);
2809 state->im = NULL; 2809 state->im = NULL;
2810 } 2810 }
2811 if (likely(state->idev != NULL)) { 2811 if (likely(state->idev)) {
2812 read_unlock_bh(&state->idev->lock); 2812 read_unlock_bh(&state->idev->lock);
2813 state->idev = NULL; 2813 state->idev = NULL;
2814 } 2814 }
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 247ad7c298f7..482dfb9f0f7e 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -311,7 +311,7 @@ static int ndisc_constructor(struct neighbour *neigh)
311 bool is_multicast = ipv6_addr_is_multicast(addr); 311 bool is_multicast = ipv6_addr_is_multicast(addr);
312 312
313 in6_dev = in6_dev_get(dev); 313 in6_dev = in6_dev_get(dev);
314 if (in6_dev == NULL) { 314 if (!in6_dev) {
315 return -EINVAL; 315 return -EINVAL;
316 } 316 }
317 317
@@ -356,7 +356,7 @@ static int pndisc_constructor(struct pneigh_entry *n)
356 struct in6_addr maddr; 356 struct in6_addr maddr;
357 struct net_device *dev = n->dev; 357 struct net_device *dev = n->dev;
358 358
359 if (dev == NULL || __in6_dev_get(dev) == NULL) 359 if (!dev || !__in6_dev_get(dev))
360 return -EINVAL; 360 return -EINVAL;
361 addrconf_addr_solict_mult(addr, &maddr); 361 addrconf_addr_solict_mult(addr, &maddr);
362 ipv6_dev_mc_inc(dev, &maddr); 362 ipv6_dev_mc_inc(dev, &maddr);
@@ -369,7 +369,7 @@ static void pndisc_destructor(struct pneigh_entry *n)
369 struct in6_addr maddr; 369 struct in6_addr maddr;
370 struct net_device *dev = n->dev; 370 struct net_device *dev = n->dev;
371 371
372 if (dev == NULL || __in6_dev_get(dev) == NULL) 372 if (!dev || !__in6_dev_get(dev))
373 return; 373 return;
374 addrconf_addr_solict_mult(addr, &maddr); 374 addrconf_addr_solict_mult(addr, &maddr);
375 ipv6_dev_mc_dec(dev, &maddr); 375 ipv6_dev_mc_dec(dev, &maddr);
@@ -560,7 +560,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
560 int optlen = 0; 560 int optlen = 0;
561 struct nd_msg *msg; 561 struct nd_msg *msg;
562 562
563 if (saddr == NULL) { 563 if (!saddr) {
564 if (ipv6_get_lladdr(dev, &addr_buf, 564 if (ipv6_get_lladdr(dev, &addr_buf,
565 (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC))) 565 (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)))
566 return; 566 return;
@@ -1030,13 +1030,13 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
1030 size_t msg_size = base_size + nla_total_size(sizeof(struct in6_addr)); 1030 size_t msg_size = base_size + nla_total_size(sizeof(struct in6_addr));
1031 1031
1032 skb = nlmsg_new(msg_size, GFP_ATOMIC); 1032 skb = nlmsg_new(msg_size, GFP_ATOMIC);
1033 if (skb == NULL) { 1033 if (!skb) {
1034 err = -ENOBUFS; 1034 err = -ENOBUFS;
1035 goto errout; 1035 goto errout;
1036 } 1036 }
1037 1037
1038 nlh = nlmsg_put(skb, 0, 0, RTM_NEWNDUSEROPT, base_size, 0); 1038 nlh = nlmsg_put(skb, 0, 0, RTM_NEWNDUSEROPT, base_size, 0);
1039 if (nlh == NULL) { 1039 if (!nlh) {
1040 goto nla_put_failure; 1040 goto nla_put_failure;
1041 } 1041 }
1042 1042
@@ -1104,7 +1104,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1104 */ 1104 */
1105 1105
1106 in6_dev = __in6_dev_get(skb->dev); 1106 in6_dev = __in6_dev_get(skb->dev);
1107 if (in6_dev == NULL) { 1107 if (!in6_dev) {
1108 ND_PRINTK(0, err, "RA: can't find inet6 device for %s\n", 1108 ND_PRINTK(0, err, "RA: can't find inet6 device for %s\n",
1109 skb->dev->name); 1109 skb->dev->name);
1110 return; 1110 return;
@@ -1199,11 +1199,11 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1199 1199
1200 ND_PRINTK(3, info, "RA: rt: %p lifetime: %d, for dev: %s\n", 1200 ND_PRINTK(3, info, "RA: rt: %p lifetime: %d, for dev: %s\n",
1201 rt, lifetime, skb->dev->name); 1201 rt, lifetime, skb->dev->name);
1202 if (rt == NULL && lifetime) { 1202 if (!rt && lifetime) {
1203 ND_PRINTK(3, info, "RA: adding default router\n"); 1203 ND_PRINTK(3, info, "RA: adding default router\n");
1204 1204
1205 rt = rt6_add_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev, pref); 1205 rt = rt6_add_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev, pref);
1206 if (rt == NULL) { 1206 if (!rt) {
1207 ND_PRINTK(0, err, 1207 ND_PRINTK(0, err,
1208 "RA: %s failed to add default route\n", 1208 "RA: %s failed to add default route\n",
1209 __func__); 1209 __func__);
@@ -1211,7 +1211,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1211 } 1211 }
1212 1212
1213 neigh = dst_neigh_lookup(&rt->dst, &ipv6_hdr(skb)->saddr); 1213 neigh = dst_neigh_lookup(&rt->dst, &ipv6_hdr(skb)->saddr);
1214 if (neigh == NULL) { 1214 if (!neigh) {
1215 ND_PRINTK(0, err, 1215 ND_PRINTK(0, err,
1216 "RA: %s got default router without neighbour\n", 1216 "RA: %s got default router without neighbour\n",
1217 __func__); 1217 __func__);
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index a5287b3582a4..79ccdb4c1b33 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -172,7 +172,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
172 read_lock(&raw_v6_hashinfo.lock); 172 read_lock(&raw_v6_hashinfo.lock);
173 sk = sk_head(&raw_v6_hashinfo.ht[hash]); 173 sk = sk_head(&raw_v6_hashinfo.ht[hash]);
174 174
175 if (sk == NULL) 175 if (!sk)
176 goto out; 176 goto out;
177 177
178 net = dev_net(skb->dev); 178 net = dev_net(skb->dev);
@@ -367,7 +367,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
367 367
368 read_lock(&raw_v6_hashinfo.lock); 368 read_lock(&raw_v6_hashinfo.lock);
369 sk = sk_head(&raw_v6_hashinfo.ht[hash]); 369 sk = sk_head(&raw_v6_hashinfo.ht[hash]);
370 if (sk != NULL) { 370 if (sk) {
371 /* Note: ipv6_hdr(skb) != skb->data */ 371 /* Note: ipv6_hdr(skb) != skb->data */
372 const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data; 372 const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
373 saddr = &ip6h->saddr; 373 saddr = &ip6h->saddr;
@@ -630,7 +630,7 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
630 skb = sock_alloc_send_skb(sk, 630 skb = sock_alloc_send_skb(sk,
631 length + hlen + tlen + 15, 631 length + hlen + tlen + 15,
632 flags & MSG_DONTWAIT, &err); 632 flags & MSG_DONTWAIT, &err);
633 if (skb == NULL) 633 if (!skb)
634 goto error; 634 goto error;
635 skb_reserve(skb, hlen); 635 skb_reserve(skb, hlen);
636 636
@@ -789,7 +789,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
789 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; 789 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK;
790 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { 790 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
791 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 791 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
792 if (flowlabel == NULL) 792 if (!flowlabel)
793 return -EINVAL; 793 return -EINVAL;
794 } 794 }
795 } 795 }
@@ -831,13 +831,13 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
831 } 831 }
832 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { 832 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) {
833 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 833 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
834 if (flowlabel == NULL) 834 if (!flowlabel)
835 return -EINVAL; 835 return -EINVAL;
836 } 836 }
837 if (!(opt->opt_nflen|opt->opt_flen)) 837 if (!(opt->opt_nflen|opt->opt_flen))
838 opt = NULL; 838 opt = NULL;
839 } 839 }
840 if (opt == NULL) 840 if (!opt)
841 opt = np->opt; 841 opt = np->opt;
842 if (flowlabel) 842 if (flowlabel)
843 opt = fl6_merge_options(&opt_space, flowlabel, opt); 843 opt = fl6_merge_options(&opt_space, flowlabel, opt);
@@ -1130,7 +1130,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
1130 1130
1131 spin_lock_bh(&sk->sk_receive_queue.lock); 1131 spin_lock_bh(&sk->sk_receive_queue.lock);
1132 skb = skb_peek(&sk->sk_receive_queue); 1132 skb = skb_peek(&sk->sk_receive_queue);
1133 if (skb != NULL) 1133 if (skb)
1134 amount = skb_tail_pointer(skb) - 1134 amount = skb_tail_pointer(skb) -
1135 skb_transport_header(skb); 1135 skb_transport_header(skb);
1136 spin_unlock_bh(&sk->sk_receive_queue.lock); 1136 spin_unlock_bh(&sk->sk_receive_queue.lock);
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index d7d70e69973b..8ffa2c8cce77 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -430,7 +430,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
430 int i, plen = 0; 430 int i, plen = 0;
431 431
432 clone = alloc_skb(0, GFP_ATOMIC); 432 clone = alloc_skb(0, GFP_ATOMIC);
433 if (clone == NULL) 433 if (!clone)
434 goto out_oom; 434 goto out_oom;
435 clone->next = head->next; 435 clone->next = head->next;
436 head->next = clone; 436 head->next = clone;
@@ -552,7 +552,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
552 552
553 fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr, 553 fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr,
554 ip6_frag_ecn(hdr)); 554 ip6_frag_ecn(hdr));
555 if (fq != NULL) { 555 if (fq) {
556 int ret; 556 int ret;
557 557
558 spin_lock(&fq->q.lock); 558 spin_lock(&fq->q.lock);
@@ -632,7 +632,7 @@ static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
632 table = ip6_frags_ns_ctl_table; 632 table = ip6_frags_ns_ctl_table;
633 if (!net_eq(net, &init_net)) { 633 if (!net_eq(net, &init_net)) {
634 table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL); 634 table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL);
635 if (table == NULL) 635 if (!table)
636 goto err_alloc; 636 goto err_alloc;
637 637
638 table[0].data = &net->ipv6.frags.high_thresh; 638 table[0].data = &net->ipv6.frags.high_thresh;
@@ -648,7 +648,7 @@ static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
648 } 648 }
649 649
650 hdr = register_net_sysctl(net, "net/ipv6", table); 650 hdr = register_net_sysctl(net, "net/ipv6", table);
651 if (hdr == NULL) 651 if (!hdr)
652 goto err_reg; 652 goto err_reg;
653 653
654 net->ipv6.sysctl.frags_hdr = hdr; 654 net->ipv6.sysctl.frags_hdr = hdr;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 58c0e6a4d15d..fe742fa0f7ff 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1476,7 +1476,7 @@ static int ip6_convert_metrics(struct mx6_config *mxc,
1476 int remaining; 1476 int remaining;
1477 u32 *mp; 1477 u32 *mp;
1478 1478
1479 if (cfg->fc_mx == NULL) 1479 if (!cfg->fc_mx)
1480 return 0; 1480 return 0;
1481 1481
1482 mp = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL); 1482 mp = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index e4cbd5798eba..92692a7e8a2b 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -118,7 +118,7 @@ static struct ip_tunnel *ipip6_tunnel_lookup(struct net *net,
118 return t; 118 return t;
119 } 119 }
120 t = rcu_dereference(sitn->tunnels_wc[0]); 120 t = rcu_dereference(sitn->tunnels_wc[0]);
121 if ((t != NULL) && (t->dev->flags & IFF_UP)) 121 if (t && (t->dev->flags & IFF_UP))
122 return t; 122 return t;
123 return NULL; 123 return NULL;
124} 124}
@@ -251,7 +251,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
251 251
252 dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, 252 dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
253 ipip6_tunnel_setup); 253 ipip6_tunnel_setup);
254 if (dev == NULL) 254 if (!dev)
255 return NULL; 255 return NULL;
256 256
257 dev_net_set(dev, net); 257 dev_net_set(dev, net);
@@ -555,7 +555,7 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
555 skb->dev, 555 skb->dev,
556 iph->daddr, 556 iph->daddr,
557 iph->saddr); 557 iph->saddr);
558 if (t == NULL) 558 if (!t)
559 goto out; 559 goto out;
560 560
561 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { 561 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
@@ -671,7 +671,7 @@ static int ipip6_rcv(struct sk_buff *skb)
671 671
672 tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev, 672 tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev,
673 iph->saddr, iph->daddr); 673 iph->saddr, iph->daddr);
674 if (tunnel != NULL) { 674 if (tunnel) {
675 struct pcpu_sw_netstats *tstats; 675 struct pcpu_sw_netstats *tstats;
676 676
677 if (tunnel->parms.iph.protocol != IPPROTO_IPV6 && 677 if (tunnel->parms.iph.protocol != IPPROTO_IPV6 &&
@@ -733,7 +733,7 @@ static int ipip_rcv(struct sk_buff *skb)
733 iph = ip_hdr(skb); 733 iph = ip_hdr(skb);
734 tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev, 734 tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev,
735 iph->saddr, iph->daddr); 735 iph->saddr, iph->daddr);
736 if (tunnel != NULL) { 736 if (tunnel) {
737 if (tunnel->parms.iph.protocol != IPPROTO_IPIP && 737 if (tunnel->parms.iph.protocol != IPPROTO_IPIP &&
738 tunnel->parms.iph.protocol != 0) 738 tunnel->parms.iph.protocol != 0)
739 goto drop; 739 goto drop;
@@ -838,7 +838,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
838 if (skb_dst(skb)) 838 if (skb_dst(skb))
839 neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr); 839 neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr);
840 840
841 if (neigh == NULL) { 841 if (!neigh) {
842 net_dbg_ratelimited("nexthop == NULL\n"); 842 net_dbg_ratelimited("nexthop == NULL\n");
843 goto tx_error; 843 goto tx_error;
844 } 844 }
@@ -867,7 +867,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
867 if (skb_dst(skb)) 867 if (skb_dst(skb))
868 neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr); 868 neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr);
869 869
870 if (neigh == NULL) { 870 if (!neigh) {
871 net_dbg_ratelimited("nexthop == NULL\n"); 871 net_dbg_ratelimited("nexthop == NULL\n");
872 goto tx_error; 872 goto tx_error;
873 } 873 }
@@ -1158,7 +1158,7 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1158 break; 1158 break;
1159 } 1159 }
1160 t = ipip6_tunnel_locate(net, &p, 0); 1160 t = ipip6_tunnel_locate(net, &p, 0);
1161 if (t == NULL) 1161 if (!t)
1162 t = netdev_priv(dev); 1162 t = netdev_priv(dev);
1163 } 1163 }
1164 1164
@@ -1206,7 +1206,7 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1206 t = ipip6_tunnel_locate(net, &p, cmd == SIOCADDTUNNEL); 1206 t = ipip6_tunnel_locate(net, &p, cmd == SIOCADDTUNNEL);
1207 1207
1208 if (dev != sitn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) { 1208 if (dev != sitn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) {
1209 if (t != NULL) { 1209 if (t) {
1210 if (t->dev != dev) { 1210 if (t->dev != dev) {
1211 err = -EEXIST; 1211 err = -EEXIST;
1212 break; 1212 break;
@@ -1242,7 +1242,7 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1242 goto done; 1242 goto done;
1243 err = -ENOENT; 1243 err = -ENOENT;
1244 t = ipip6_tunnel_locate(net, &p, 0); 1244 t = ipip6_tunnel_locate(net, &p, 0);
1245 if (t == NULL) 1245 if (!t)
1246 goto done; 1246 goto done;
1247 err = -EPERM; 1247 err = -EPERM;
1248 if (t == netdev_priv(sitn->fb_tunnel_dev)) 1248 if (t == netdev_priv(sitn->fb_tunnel_dev))
@@ -1795,7 +1795,7 @@ static void __net_exit sit_destroy_tunnels(struct net *net,
1795 struct ip_tunnel *t; 1795 struct ip_tunnel *t;
1796 1796
1797 t = rtnl_dereference(sitn->tunnels[prio][h]); 1797 t = rtnl_dereference(sitn->tunnels[prio][h]);
1798 while (t != NULL) { 1798 while (t) {
1799 /* If dev is in the same netns, it has already 1799 /* If dev is in the same netns, it has already
1800 * been added to the list by the previous loop. 1800 * been added to the list by the previous loop.
1801 */ 1801 */
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 30f5a4ad04eb..abcc79f649b3 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -179,7 +179,7 @@ int ipv6_sysctl_register(void)
179 int err = -ENOMEM; 179 int err = -ENOMEM;
180 180
181 ip6_header = register_net_sysctl(&init_net, "net/ipv6", ipv6_rotable); 181 ip6_header = register_net_sysctl(&init_net, "net/ipv6", ipv6_rotable);
182 if (ip6_header == NULL) 182 if (!ip6_header)
183 goto out; 183 goto out;
184 184
185 err = register_pernet_subsys(&ipv6_sysctl_net_ops); 185 err = register_pernet_subsys(&ipv6_sysctl_net_ops);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index cbdf6912d2c6..7cdad8401434 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -141,7 +141,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
141 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { 141 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
142 struct ip6_flowlabel *flowlabel; 142 struct ip6_flowlabel *flowlabel;
143 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 143 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
144 if (flowlabel == NULL) 144 if (!flowlabel)
145 return -EINVAL; 145 return -EINVAL;
146 fl6_sock_release(flowlabel); 146 fl6_sock_release(flowlabel);
147 } 147 }
@@ -247,7 +247,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
247 goto failure; 247 goto failure;
248 } 248 }
249 249
250 if (saddr == NULL) { 250 if (!saddr) {
251 saddr = &fl6.saddr; 251 saddr = &fl6.saddr;
252 sk->sk_v6_rcv_saddr = *saddr; 252 sk->sk_v6_rcv_saddr = *saddr;
253 } 253 }
@@ -412,7 +412,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
412 /* Only in fast or simultaneous open. If a fast open socket is 412 /* Only in fast or simultaneous open. If a fast open socket is
413 * is already accepted it is treated as a connected one below. 413 * is already accepted it is treated as a connected one below.
414 */ 414 */
415 if (fastopen && fastopen->sk == NULL) 415 if (fastopen && !fastopen->sk)
416 break; 416 break;
417 417
418 if (!sock_owned_by_user(sk)) { 418 if (!sock_owned_by_user(sk)) {
@@ -460,7 +460,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
460 &ireq->ir_v6_rmt_addr); 460 &ireq->ir_v6_rmt_addr);
461 461
462 fl6->daddr = ireq->ir_v6_rmt_addr; 462 fl6->daddr = ireq->ir_v6_rmt_addr;
463 if (np->repflow && (ireq->pktopts != NULL)) 463 if (np->repflow && ireq->pktopts)
464 fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts)); 464 fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts));
465 465
466 skb_set_queue_mapping(skb, queue_mapping); 466 skb_set_queue_mapping(skb, queue_mapping);
@@ -750,7 +750,7 @@ static void tcp_v6_send_response(struct sock *sk, struct sk_buff *skb, u32 seq,
750 750
751 buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len, 751 buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
752 GFP_ATOMIC); 752 GFP_ATOMIC);
753 if (buff == NULL) 753 if (!buff)
754 return; 754 return;
755 755
756 skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); 756 skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len);
@@ -1008,7 +1008,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1008 1008
1009 newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst); 1009 newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst);
1010 1010
1011 if (newsk == NULL) 1011 if (!newsk)
1012 return NULL; 1012 return NULL;
1013 1013
1014 newtcp6sk = (struct tcp6_sock *)newsk; 1014 newtcp6sk = (struct tcp6_sock *)newsk;
@@ -1065,7 +1065,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1065 } 1065 }
1066 1066
1067 newsk = tcp_create_openreq_child(sk, req, skb); 1067 newsk = tcp_create_openreq_child(sk, req, skb);
1068 if (newsk == NULL) 1068 if (!newsk)
1069 goto out_nonewsk; 1069 goto out_nonewsk;
1070 1070
1071 /* 1071 /*
@@ -1107,7 +1107,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1107 1107
1108 /* Clone pktoptions received with SYN */ 1108 /* Clone pktoptions received with SYN */
1109 newnp->pktoptions = NULL; 1109 newnp->pktoptions = NULL;
1110 if (ireq->pktopts != NULL) { 1110 if (ireq->pktopts) {
1111 newnp->pktoptions = skb_clone(ireq->pktopts, 1111 newnp->pktoptions = skb_clone(ireq->pktopts,
1112 sk_gfp_atomic(sk, GFP_ATOMIC)); 1112 sk_gfp_atomic(sk, GFP_ATOMIC));
1113 consume_skb(ireq->pktopts); 1113 consume_skb(ireq->pktopts);
@@ -1152,7 +1152,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1152#ifdef CONFIG_TCP_MD5SIG 1152#ifdef CONFIG_TCP_MD5SIG
1153 /* Copy over the MD5 key from the original socket */ 1153 /* Copy over the MD5 key from the original socket */
1154 key = tcp_v6_md5_do_lookup(sk, &newsk->sk_v6_daddr); 1154 key = tcp_v6_md5_do_lookup(sk, &newsk->sk_v6_daddr);
1155 if (key != NULL) { 1155 if (key) {
1156 /* We're using one, so create a matching key 1156 /* We're using one, so create a matching key
1157 * on the newsk structure. If we fail to get 1157 * on the newsk structure. If we fail to get
1158 * memory, then we end up not copying the key 1158 * memory, then we end up not copying the key
@@ -1475,7 +1475,7 @@ do_time_wait:
1475 &ipv6_hdr(skb)->saddr, th->source, 1475 &ipv6_hdr(skb)->saddr, th->source,
1476 &ipv6_hdr(skb)->daddr, 1476 &ipv6_hdr(skb)->daddr,
1477 ntohs(th->dest), tcp_v6_iif(skb)); 1477 ntohs(th->dest), tcp_v6_iif(skb));
1478 if (sk2 != NULL) { 1478 if (sk2) {
1479 struct inet_timewait_sock *tw = inet_twsk(sk); 1479 struct inet_timewait_sock *tw = inet_twsk(sk);
1480 inet_twsk_deschedule(tw, &tcp_death_row); 1480 inet_twsk_deschedule(tw, &tcp_death_row);
1481 inet_twsk_put(tw); 1481 inet_twsk_put(tw);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 7fe0329c0d37..120aff9aa010 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -550,7 +550,7 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
550 550
551 sk = __udp6_lib_lookup(net, daddr, uh->dest, 551 sk = __udp6_lib_lookup(net, daddr, uh->dest,
552 saddr, uh->source, inet6_iif(skb), udptable); 552 saddr, uh->source, inet6_iif(skb), udptable);
553 if (sk == NULL) { 553 if (!sk) {
554 ICMP6_INC_STATS_BH(net, __in6_dev_get(skb->dev), 554 ICMP6_INC_STATS_BH(net, __in6_dev_get(skb->dev),
555 ICMP6_MIB_INERRORS); 555 ICMP6_MIB_INERRORS);
556 return; 556 return;
@@ -648,7 +648,7 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
648 648
649 /* if we're overly short, let UDP handle it */ 649 /* if we're overly short, let UDP handle it */
650 encap_rcv = ACCESS_ONCE(up->encap_rcv); 650 encap_rcv = ACCESS_ONCE(up->encap_rcv);
651 if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) { 651 if (skb->len > sizeof(struct udphdr) && encap_rcv) {
652 int ret; 652 int ret;
653 653
654 /* Verify checksum before giving to encap */ 654 /* Verify checksum before giving to encap */
@@ -749,7 +749,7 @@ static void flush_stack(struct sock **stack, unsigned int count,
749 749
750 for (i = 0; i < count; i++) { 750 for (i = 0; i < count; i++) {
751 sk = stack[i]; 751 sk = stack[i];
752 if (likely(skb1 == NULL)) 752 if (likely(!skb1))
753 skb1 = (i == final) ? skb : skb_clone(skb, GFP_ATOMIC); 753 skb1 = (i == final) ? skb : skb_clone(skb, GFP_ATOMIC);
754 if (!skb1) { 754 if (!skb1) {
755 atomic_inc(&sk->sk_drops); 755 atomic_inc(&sk->sk_drops);
@@ -899,7 +899,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
899 * for sock caches... i'll skip this for now. 899 * for sock caches... i'll skip this for now.
900 */ 900 */
901 sk = __udp6_lib_lookup_skb(skb, uh->source, uh->dest, udptable); 901 sk = __udp6_lib_lookup_skb(skb, uh->source, uh->dest, udptable);
902 if (sk != NULL) { 902 if (sk) {
903 int ret; 903 int ret;
904 904
905 if (!uh->check && !udp_sk(sk)->no_check6_rx) { 905 if (!uh->check && !udp_sk(sk)->no_check6_rx) {
@@ -1207,7 +1207,7 @@ do_udp_sendmsg:
1207 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; 1207 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK;
1208 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { 1208 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
1209 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 1209 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
1210 if (flowlabel == NULL) 1210 if (!flowlabel)
1211 return -EINVAL; 1211 return -EINVAL;
1212 } 1212 }
1213 } 1213 }
@@ -1255,14 +1255,14 @@ do_udp_sendmsg:
1255 } 1255 }
1256 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { 1256 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) {
1257 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 1257 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
1258 if (flowlabel == NULL) 1258 if (!flowlabel)
1259 return -EINVAL; 1259 return -EINVAL;
1260 } 1260 }
1261 if (!(opt->opt_nflen|opt->opt_flen)) 1261 if (!(opt->opt_nflen|opt->opt_flen))
1262 opt = NULL; 1262 opt = NULL;
1263 connected = 0; 1263 connected = 0;
1264 } 1264 }
1265 if (opt == NULL) 1265 if (!opt)
1266 opt = np->opt; 1266 opt = np->opt;
1267 if (flowlabel) 1267 if (flowlabel)
1268 opt = fl6_merge_options(&opt_space, flowlabel, opt); 1268 opt = fl6_merge_options(&opt_space, flowlabel, opt);
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 11dbcc1790d2..91d934c22a2a 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -370,7 +370,7 @@ static void __net_exit xfrm6_net_exit(struct net *net)
370{ 370{
371 struct ctl_table *table; 371 struct ctl_table *table;
372 372
373 if (net->ipv6.sysctl.xfrm6_hdr == NULL) 373 if (!net->ipv6.sysctl.xfrm6_hdr)
374 return; 374 return;
375 375
376 table = net->ipv6.sysctl.xfrm6_hdr->ctl_table_arg; 376 table = net->ipv6.sysctl.xfrm6_hdr->ctl_table_arg;