aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Morris <ipm@chirality.org.uk>2015-03-29 09:00:05 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-31 13:51:54 -0400
commit53b24b8f94cb15e38e332db82177cf3f0f4df0c5 (patch)
treec314553dc093f5226913a247c36c03012f7d22d7
parent63159f29be1df7f93563a8a0f78c5e65fc844ed6 (diff)
ipv6: coding style: comparison for inequality with NULL
The ipv6 code uses a mixture of coding styles. In some instances check for NULL pointer is done as x != NULL and sometimes as x. x is preferred according to checkpatch and this patch makes the code consistent by adopting the latter form. No changes detected by objdiff. Signed-off-by: Ian Morris <ipm@chirality.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/addrconf_core.c2
-rw-r--r--net/ipv6/af_inet6.c6
-rw-r--r--net/ipv6/ip6_fib.c4
-rw-r--r--net/ipv6/ip6_flowlabel.c6
-rw-r--r--net/ipv6/ip6_gre.c6
-rw-r--r--net/ipv6/ip6_input.c2
-rw-r--r--net/ipv6/ip6_offload.c2
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ip6_tunnel.c4
-rw-r--r--net/ipv6/ip6_vti.c6
-rw-r--r--net/ipv6/ip6mr.c2
-rw-r--r--net/ipv6/mcast.c16
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/reassembly.c2
-rw-r--r--net/ipv6/sit.c10
-rw-r--r--net/ipv6/tcp_ipv6.c8
-rw-r--r--net/ipv6/udp.c4
17 files changed, 43 insertions, 43 deletions
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 0e4889736a87..eef63b394c5a 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -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);
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 3f54ac5f05b8..d491125011c4 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -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;
@@ -300,7 +300,7 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
300 if (!fopt || 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;
@@ -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 aa9ea6e0d63a..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;
@@ -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;
@@ -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 8b6d40223090..84c58da10f5c 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -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 =
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 6740206b83cf..0c68012b6d6e 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -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);
@@ -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 a045d543e507..1ec5b4a530d0 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -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;
@@ -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;
@@ -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 ebb0514546a6..ff883c9d0e3c 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -305,7 +305,7 @@ 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);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 3017c4a83ccc..fac1f27e428e 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -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);
@@ -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/raw.c b/net/ipv6/raw.c
index e33576df4658..79ccdb4c1b33 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -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;
@@ -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 24fbc0abfff6..8ffa2c8cce77 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -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);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index c61ed24cd098..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}
@@ -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;
@@ -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;
@@ -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/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index a8a74d36d893..7cdad8401434 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -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);
@@ -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 58efd2c5c127..120aff9aa010 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -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 */
@@ -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) {