aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorOctavian Purdila <opurdila@ixiacom.com>2009-11-25 18:14:13 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-25 18:14:13 -0500
commit09ad9bc752519cc167d0a573e1acf69b5c707c67 (patch)
tree0e190a9ffb90d7e0534136c3e9f31dce02f423c3 /net
parent4ba3eb034fb6fd1990ccc5a6d71d5abcda37b905 (diff)
net: use net_eq to compare nets
Generated with the following semantic patch @@ struct net *n1; struct net *n2; @@ - n1 == n2 + net_eq(n1, n2) @@ struct net *n1; struct net *n2; @@ - n1 != n2 + !net_eq(n1, n2) applied over {include,net,drivers/net}. Signed-off-by: Octavian Purdila <opurdila@ixiacom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/appletalk/ddp.c2
-rw-r--r--net/atm/svc.c2
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/can/af_can.c2
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/core/net_namespace.c2
-rw-r--r--net/core/sysctl_net_core.c2
-rw-r--r--net/dcb/dcbnl.c2
-rw-r--r--net/decnet/af_decnet.c2
-rw-r--r--net/decnet/dn_dev.c6
-rw-r--r--net/decnet/dn_fib.c4
-rw-r--r--net/decnet/dn_route.c4
-rw-r--r--net/decnet/dn_table.c2
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ieee802154/af_ieee802154.c2
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_semantics.c4
-rw-r--r--net/ipv4/inet_connection_sock.c4
-rw-r--r--net/ipv4/inet_hashtables.c3
-rw-r--r--net/ipv4/ip_fragment.c4
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/netfilter/ip_queue.c2
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/sysctl_net_ipv4.c4
-rw-r--r--net/ipv6/addrconf.c4
-rw-r--r--net/ipv6/ip6_flowlabel.c9
-rw-r--r--net/ipv6/netfilter/ip6_queue.c2
-rw-r--r--net/ipv6/reassembly.c4
-rw-r--r--net/ipx/af_ipx.c2
-rw-r--r--net/llc/af_llc.c2
-rw-r--r--net/netfilter/nfnetlink_log.c2
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/packet/af_packet.c6
-rw-r--r--net/rose/af_rose.c2
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/sched/act_api.c4
-rw-r--r--net/sched/cls_api.c4
-rw-r--r--net/sched/sch_api.c10
-rw-r--r--net/tipc/socket.c2
-rw-r--r--net/x25/af_x25.c2
43 files changed, 69 insertions, 67 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 73ca4d52492..9fc4da56fb1 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1023,7 +1023,7 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol,
1023 struct sock *sk; 1023 struct sock *sk;
1024 int rc = -ESOCKTNOSUPPORT; 1024 int rc = -ESOCKTNOSUPPORT;
1025 1025
1026 if (net != &init_net) 1026 if (!net_eq(net, &init_net))
1027 return -EAFNOSUPPORT; 1027 return -EAFNOSUPPORT;
1028 1028
1029 /* 1029 /*
diff --git a/net/atm/svc.c b/net/atm/svc.c
index c7395070ee7..66e1d9b3e5d 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -655,7 +655,7 @@ static int svc_create(struct net *net, struct socket *sock, int protocol,
655{ 655{
656 int error; 656 int error;
657 657
658 if (net != &init_net) 658 if (!net_eq(net, &init_net))
659 return -EAFNOSUPPORT; 659 return -EAFNOSUPPORT;
660 660
661 sock->ops = &svc_proto_ops; 661 sock->ops = &svc_proto_ops;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index d6ddfa4c447..5588ba69c46 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -805,7 +805,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
805 struct sock *sk; 805 struct sock *sk;
806 ax25_cb *ax25; 806 ax25_cb *ax25;
807 807
808 if (net != &init_net) 808 if (!net_eq(net, &init_net))
809 return -EAFNOSUPPORT; 809 return -EAFNOSUPPORT;
810 810
811 switch (sock->type) { 811 switch (sock->type) {
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 833bd838edc..f3067172886 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -126,7 +126,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
126 if (protocol < 0 || protocol >= CAN_NPROTO) 126 if (protocol < 0 || protocol >= CAN_NPROTO)
127 return -EINVAL; 127 return -EINVAL;
128 128
129 if (net != &init_net) 129 if (!net_eq(net, &init_net))
130 return -EAFNOSUPPORT; 130 return -EAFNOSUPPORT;
131 131
132#ifdef CONFIG_MODULES 132#ifdef CONFIG_MODULES
diff --git a/net/core/dev.c b/net/core/dev.c
index ccefa2473c3..e65af604141 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -985,7 +985,7 @@ rollback:
985 /* For now only devices in the initial network namespace 985 /* For now only devices in the initial network namespace
986 * are in sysfs. 986 * are in sysfs.
987 */ 987 */
988 if (net == &init_net) { 988 if (net_eq(net, &init_net)) {
989 ret = device_rename(&dev->dev, dev->name); 989 ret = device_rename(&dev->dev, dev->name);
990 if (ret) { 990 if (ret) {
991 memcpy(dev->name, oldname, IFNAMSIZ); 991 memcpy(dev->name, oldname, IFNAMSIZ);
@@ -4792,7 +4792,7 @@ static void rollback_registered_many(struct list_head *head)
4792 list_for_each_entry_safe(dev, aux, head, unreg_list) { 4792 list_for_each_entry_safe(dev, aux, head, unreg_list) {
4793 int new_net = 1; 4793 int new_net = 1;
4794 list_for_each_entry(fdev, &pernet_list, unreg_list) { 4794 list_for_each_entry(fdev, &pernet_list, unreg_list) {
4795 if (dev_net(dev) == dev_net(fdev)) { 4795 if (net_eq(dev_net(dev), dev_net(fdev))) {
4796 new_net = 0; 4796 new_net = 0;
4797 dev_put(dev); 4797 dev_put(dev);
4798 break; 4798 break;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index e587e681969..a08a35bf0a7 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2092,7 +2092,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
2092 if (h > s_h) 2092 if (h > s_h)
2093 s_idx = 0; 2093 s_idx = 0;
2094 for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) { 2094 for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) {
2095 if (dev_net(n->dev) != net) 2095 if (!net_eq(dev_net(n->dev), net))
2096 continue; 2096 continue;
2097 if (idx < s_idx) 2097 if (idx < s_idx)
2098 goto next; 2098 goto next;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 157645c0da7..fbc1c7472c5 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -525,7 +525,7 @@ void netdev_unregister_kobject(struct net_device * net)
525 525
526 kobject_get(&dev->kobj); 526 kobject_get(&dev->kobj);
527 527
528 if (dev_net(net) != &init_net) 528 if (!net_eq(dev_net(net), &init_net))
529 return; 529 return;
530 530
531 device_del(dev); 531 device_del(dev);
@@ -559,7 +559,7 @@ int netdev_register_kobject(struct net_device *net)
559#endif 559#endif
560#endif /* CONFIG_SYSFS */ 560#endif /* CONFIG_SYSFS */
561 561
562 if (dev_net(net) != &init_net) 562 if (!net_eq(dev_net(net), &init_net))
563 return 0; 563 return 0;
564 564
565 return device_add(dev); 565 return device_add(dev);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 1c1af2756f3..86ed7f44d08 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -280,7 +280,7 @@ out_undo:
280 list_del(&ops->list); 280 list_del(&ops->list);
281 if (ops->exit) { 281 if (ops->exit) {
282 for_each_net(undo_net) { 282 for_each_net(undo_net) {
283 if (undo_net == net) 283 if (net_eq(undo_net, net))
284 goto undone; 284 goto undone;
285 ops->exit(undo_net); 285 ops->exit(undo_net);
286 } 286 }
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 7db1de0497c..fcfc5458c39 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -134,7 +134,7 @@ static __net_init int sysctl_core_net_init(struct net *net)
134 net->core.sysctl_somaxconn = SOMAXCONN; 134 net->core.sysctl_somaxconn = SOMAXCONN;
135 135
136 tbl = netns_core_table; 136 tbl = netns_core_table;
137 if (net != &init_net) { 137 if (!net_eq(net, &init_net)) {
138 tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL); 138 tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);
139 if (tbl == NULL) 139 if (tbl == NULL)
140 goto err_dup; 140 goto err_dup;
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ac1205df6c8..2afd617104d 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1126,7 +1126,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1126 u32 pid = skb ? NETLINK_CB(skb).pid : 0; 1126 u32 pid = skb ? NETLINK_CB(skb).pid : 0;
1127 int ret = -EINVAL; 1127 int ret = -EINVAL;
1128 1128
1129 if (net != &init_net) 1129 if (!net_eq(net, &init_net))
1130 return -EINVAL; 1130 return -EINVAL;
1131 1131
1132 ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, 1132 ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX,
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 9ade3a6de95..2b494fac946 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -680,7 +680,7 @@ static int dn_create(struct net *net, struct socket *sock, int protocol,
680{ 680{
681 struct sock *sk; 681 struct sock *sk;
682 682
683 if (net != &init_net) 683 if (!net_eq(net, &init_net))
684 return -EAFNOSUPPORT; 684 return -EAFNOSUPPORT;
685 685
686 switch(sock->type) { 686 switch(sock->type) {
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 6c916e2b8a8..f20dec9cfa0 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -636,7 +636,7 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
636 struct dn_ifaddr *ifa, **ifap; 636 struct dn_ifaddr *ifa, **ifap;
637 int err = -EINVAL; 637 int err = -EINVAL;
638 638
639 if (net != &init_net) 639 if (!net_eq(net, &init_net))
640 goto errout; 640 goto errout;
641 641
642 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy); 642 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
@@ -675,7 +675,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
675 struct dn_ifaddr *ifa; 675 struct dn_ifaddr *ifa;
676 int err; 676 int err;
677 677
678 if (net != &init_net) 678 if (!net_eq(net, &init_net))
679 return -EINVAL; 679 return -EINVAL;
680 680
681 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy); 681 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
@@ -789,7 +789,7 @@ static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
789 struct dn_dev *dn_db; 789 struct dn_dev *dn_db;
790 struct dn_ifaddr *ifa; 790 struct dn_ifaddr *ifa;
791 791
792 if (net != &init_net) 792 if (!net_eq(net, &init_net))
793 return 0; 793 return 0;
794 794
795 skip_ndevs = cb->args[0]; 795 skip_ndevs = cb->args[0];
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index fd641f65e09..e9d48700e83 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -509,7 +509,7 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
509 struct rtattr **rta = arg; 509 struct rtattr **rta = arg;
510 struct rtmsg *r = NLMSG_DATA(nlh); 510 struct rtmsg *r = NLMSG_DATA(nlh);
511 511
512 if (net != &init_net) 512 if (!net_eq(net, &init_net))
513 return -EINVAL; 513 return -EINVAL;
514 514
515 if (dn_fib_check_attr(r, rta)) 515 if (dn_fib_check_attr(r, rta))
@@ -529,7 +529,7 @@ static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
529 struct rtattr **rta = arg; 529 struct rtattr **rta = arg;
530 struct rtmsg *r = NLMSG_DATA(nlh); 530 struct rtmsg *r = NLMSG_DATA(nlh);
531 531
532 if (net != &init_net) 532 if (!net_eq(net, &init_net))
533 return -EINVAL; 533 return -EINVAL;
534 534
535 if (dn_fib_check_attr(r, rta)) 535 if (dn_fib_check_attr(r, rta))
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 860286a3921..a03284061a3 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1517,7 +1517,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
1517 struct sk_buff *skb; 1517 struct sk_buff *skb;
1518 struct flowi fl; 1518 struct flowi fl;
1519 1519
1520 if (net != &init_net) 1520 if (!net_eq(net, &init_net))
1521 return -EINVAL; 1521 return -EINVAL;
1522 1522
1523 memset(&fl, 0, sizeof(fl)); 1523 memset(&fl, 0, sizeof(fl));
@@ -1602,7 +1602,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
1602 int h, s_h; 1602 int h, s_h;
1603 int idx, s_idx; 1603 int idx, s_idx;
1604 1604
1605 if (net != &init_net) 1605 if (!net_eq(net, &init_net))
1606 return 0; 1606 return 0;
1607 1607
1608 if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg)) 1608 if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg))
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index 67054b0d550..f281e0f59b0 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -471,7 +471,7 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
471 struct hlist_node *node; 471 struct hlist_node *node;
472 int dumped = 0; 472 int dumped = 0;
473 473
474 if (net != &init_net) 474 if (!net_eq(net, &init_net))
475 return 0; 475 return 0;
476 476
477 if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) && 477 if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) &&
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 596679803de..29b4931aae5 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -612,7 +612,7 @@ static int econet_create(struct net *net, struct socket *sock, int protocol,
612 struct econet_sock *eo; 612 struct econet_sock *eo;
613 int err; 613 int err;
614 614
615 if (net != &init_net) 615 if (!net_eq(net, &init_net))
616 return -EAFNOSUPPORT; 616 return -EAFNOSUPPORT;
617 617
618 /* Econet only provides datagram services. */ 618 /* Econet only provides datagram services. */
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index de6e34d2a7f..bad1c49fd96 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -241,7 +241,7 @@ static int ieee802154_create(struct net *net, struct socket *sock,
241 struct proto *proto; 241 struct proto *proto;
242 const struct proto_ops *ops; 242 const struct proto_ops *ops;
243 243
244 if (net != &init_net) 244 if (!net_eq(net, &init_net))
245 return -EAFNOSUPPORT; 245 return -EAFNOSUPPORT;
246 246
247 switch (sock->type) { 247 switch (sock->type) {
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7620382058a..c100709d6dd 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1605,7 +1605,7 @@ static __net_init int devinet_init_net(struct net *net)
1605 all = &ipv4_devconf; 1605 all = &ipv4_devconf;
1606 dflt = &ipv4_devconf_dflt; 1606 dflt = &ipv4_devconf_dflt;
1607 1607
1608 if (net != &init_net) { 1608 if (!net_eq(net, &init_net)) {
1609 all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL); 1609 all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
1610 if (all == NULL) 1610 if (all == NULL)
1611 goto err_alloc_all; 1611 goto err_alloc_all;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 9b096d6ff3f..ed19aa6919c 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -228,7 +228,7 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi)
228 head = &fib_info_hash[hash]; 228 head = &fib_info_hash[hash];
229 229
230 hlist_for_each_entry(fi, node, head, fib_hash) { 230 hlist_for_each_entry(fi, node, head, fib_hash) {
231 if (fi->fib_net != nfi->fib_net) 231 if (!net_eq(fi->fib_net, nfi->fib_net))
232 continue; 232 continue;
233 if (fi->fib_nhs != nfi->fib_nhs) 233 if (fi->fib_nhs != nfi->fib_nhs)
234 continue; 234 continue;
@@ -1047,7 +1047,7 @@ int fib_sync_down_addr(struct net *net, __be32 local)
1047 return 0; 1047 return 0;
1048 1048
1049 hlist_for_each_entry(fi, node, head, fib_lhash) { 1049 hlist_for_each_entry(fi, node, head, fib_lhash) {
1050 if (fi->fib_net != net) 1050 if (!net_eq(fi->fib_net, net))
1051 continue; 1051 continue;
1052 if (fi->fib_prefsrc == local) { 1052 if (fi->fib_prefsrc == local) {
1053 fi->fib_flags |= RTNH_F_DEAD; 1053 fi->fib_flags |= RTNH_F_DEAD;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 26fb50e9131..9b35c56d102 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -112,7 +112,7 @@ again:
112 hashinfo->bhash_size)]; 112 hashinfo->bhash_size)];
113 spin_lock(&head->lock); 113 spin_lock(&head->lock);
114 inet_bind_bucket_for_each(tb, node, &head->chain) 114 inet_bind_bucket_for_each(tb, node, &head->chain)
115 if (ib_net(tb) == net && tb->port == rover) { 115 if (net_eq(ib_net(tb), net) && tb->port == rover) {
116 if (tb->fastreuse > 0 && 116 if (tb->fastreuse > 0 &&
117 sk->sk_reuse && 117 sk->sk_reuse &&
118 sk->sk_state != TCP_LISTEN && 118 sk->sk_state != TCP_LISTEN &&
@@ -158,7 +158,7 @@ have_snum:
158 hashinfo->bhash_size)]; 158 hashinfo->bhash_size)];
159 spin_lock(&head->lock); 159 spin_lock(&head->lock);
160 inet_bind_bucket_for_each(tb, node, &head->chain) 160 inet_bind_bucket_for_each(tb, node, &head->chain)
161 if (ib_net(tb) == net && tb->port == snum) 161 if (net_eq(ib_net(tb), net) && tb->port == snum)
162 goto tb_found; 162 goto tb_found;
163 } 163 }
164 tb = NULL; 164 tb = NULL;
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 47ad7aab51e..94ef51aa5bc 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -454,7 +454,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
454 * unique enough. 454 * unique enough.
455 */ 455 */
456 inet_bind_bucket_for_each(tb, node, &head->chain) { 456 inet_bind_bucket_for_each(tb, node, &head->chain) {
457 if (ib_net(tb) == net && tb->port == port) { 457 if (net_eq(ib_net(tb), net) &&
458 tb->port == port) {
458 if (tb->fastreuse >= 0) 459 if (tb->fastreuse >= 0)
459 goto next_port; 460 goto next_port;
460 WARN_ON(hlist_empty(&tb->owners)); 461 WARN_ON(hlist_empty(&tb->owners));
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index b007f8af6e1..1472d8e3c19 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -658,7 +658,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
658 struct ctl_table_header *hdr; 658 struct ctl_table_header *hdr;
659 659
660 table = ip4_frags_ns_ctl_table; 660 table = ip4_frags_ns_ctl_table;
661 if (net != &init_net) { 661 if (!net_eq(net, &init_net)) {
662 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL); 662 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
663 if (table == NULL) 663 if (table == NULL)
664 goto err_alloc; 664 goto err_alloc;
@@ -676,7 +676,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
676 return 0; 676 return 0;
677 677
678err_reg: 678err_reg:
679 if (net != &init_net) 679 if (!net_eq(net, &init_net))
680 kfree(table); 680 kfree(table);
681err_alloc: 681err_alloc:
682 return -ENOMEM; 682 return -ENOMEM;
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index fdf51badc8e..c29de9879fd 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -164,7 +164,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
164 if (sk && inet_sk(sk)->inet_num == protocol && 164 if (sk && inet_sk(sk)->inet_num == protocol &&
165 (!sk->sk_bound_dev_if || 165 (!sk->sk_bound_dev_if ||
166 sk->sk_bound_dev_if == dev->ifindex) && 166 sk->sk_bound_dev_if == dev->ifindex) &&
167 sock_net(sk) == dev_net(dev)) { 167 net_eq(sock_net(sk), dev_net(dev))) {
168 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { 168 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
169 if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) { 169 if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
170 read_unlock(&ip_ra_lock); 170 read_unlock(&ip_ra_lock);
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index c156db21598..884f0859cb3 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -500,7 +500,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
500 if (event == NETLINK_URELEASE && 500 if (event == NETLINK_URELEASE &&
501 n->protocol == NETLINK_FIREWALL && n->pid) { 501 n->protocol == NETLINK_FIREWALL && n->pid) {
502 write_lock_bh(&queue_lock); 502 write_lock_bh(&queue_lock);
503 if ((n->net == &init_net) && (n->pid == peer_pid)) 503 if ((net_eq(n->net, &init_net)) && (n->pid == peer_pid))
504 __ipq_reset(); 504 __ipq_reset();
505 write_unlock_bh(&queue_lock); 505 write_unlock_bh(&queue_lock);
506 } 506 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 7547944ea9b..aea7bb369cf 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -703,7 +703,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
703 703
704static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) 704static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
705{ 705{
706 return dev_net(rt1->u.dst.dev) == dev_net(rt2->u.dst.dev); 706 return net_eq(dev_net(rt1->u.dst.dev), dev_net(rt2->u.dst.dev));
707} 707}
708 708
709static inline int rt_is_expired(struct rtable *rth) 709static inline int rt_is_expired(struct rtable *rth)
@@ -3310,7 +3310,7 @@ static __net_init int sysctl_route_net_init(struct net *net)
3310 struct ctl_table *tbl; 3310 struct ctl_table *tbl;
3311 3311
3312 tbl = ipv4_route_flush_table; 3312 tbl = ipv4_route_flush_table;
3313 if (net != &init_net) { 3313 if (!net_eq(net, &init_net)) {
3314 tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); 3314 tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL);
3315 if (tbl == NULL) 3315 if (tbl == NULL)
3316 goto err_dup; 3316 goto err_dup;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 2dcf04d9b00..c00323bae04 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -818,7 +818,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
818 struct ctl_table *table; 818 struct ctl_table *table;
819 819
820 table = ipv4_net_table; 820 table = ipv4_net_table;
821 if (net != &init_net) { 821 if (!net_eq(net, &init_net)) {
822 table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL); 822 table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL);
823 if (table == NULL) 823 if (table == NULL)
824 goto err_alloc; 824 goto err_alloc;
@@ -849,7 +849,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
849 return 0; 849 return 0;
850 850
851err_reg: 851err_reg:
852 if (net != &init_net) 852 if (!net_eq(net, &init_net))
853 kfree(table); 853 kfree(table);
854err_alloc: 854err_alloc:
855 return -ENOMEM; 855 return -ENOMEM;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 522bdc77206..b1ce8fc6204 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4498,7 +4498,7 @@ static int addrconf_init_net(struct net *net)
4498 all = &ipv6_devconf; 4498 all = &ipv6_devconf;
4499 dflt = &ipv6_devconf_dflt; 4499 dflt = &ipv6_devconf_dflt;
4500 4500
4501 if (net != &init_net) { 4501 if (!net_eq(net, &init_net)) {
4502 all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL); 4502 all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL);
4503 if (all == NULL) 4503 if (all == NULL)
4504 goto err_alloc_all; 4504 goto err_alloc_all;
@@ -4546,7 +4546,7 @@ static void addrconf_exit_net(struct net *net)
4546 __addrconf_sysctl_unregister(net->ipv6.devconf_dflt); 4546 __addrconf_sysctl_unregister(net->ipv6.devconf_dflt);
4547 __addrconf_sysctl_unregister(net->ipv6.devconf_all); 4547 __addrconf_sysctl_unregister(net->ipv6.devconf_all);
4548#endif 4548#endif
4549 if (net != &init_net) { 4549 if (!net_eq(net, &init_net)) {
4550 kfree(net->ipv6.devconf_dflt); 4550 kfree(net->ipv6.devconf_dflt);
4551 kfree(net->ipv6.devconf_all); 4551 kfree(net->ipv6.devconf_all);
4552 } 4552 }
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 593a67e8d3f..6e7bffa2205 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -67,7 +67,7 @@ static inline struct ip6_flowlabel *__fl_lookup(struct net *net, __be32 label)
67 struct ip6_flowlabel *fl; 67 struct ip6_flowlabel *fl;
68 68
69 for (fl=fl_ht[FL_HASH(label)]; fl; fl = fl->next) { 69 for (fl=fl_ht[FL_HASH(label)]; fl; fl = fl->next) {
70 if (fl->label == label && fl->fl_net == net) 70 if (fl->label == label && net_eq(fl->fl_net, net))
71 return fl; 71 return fl;
72 } 72 }
73 return NULL; 73 return NULL;
@@ -163,7 +163,8 @@ static void ip6_fl_purge(struct net *net)
163 struct ip6_flowlabel *fl, **flp; 163 struct ip6_flowlabel *fl, **flp;
164 flp = &fl_ht[i]; 164 flp = &fl_ht[i];
165 while ((fl = *flp) != NULL) { 165 while ((fl = *flp) != NULL) {
166 if (fl->fl_net == net && atomic_read(&fl->users) == 0) { 166 if (net_eq(fl->fl_net, net) &&
167 atomic_read(&fl->users) == 0) {
167 *flp = fl->next; 168 *flp = fl->next;
168 fl_free(fl); 169 fl_free(fl);
169 atomic_dec(&fl_size); 170 atomic_dec(&fl_size);
@@ -630,7 +631,7 @@ static struct ip6_flowlabel *ip6fl_get_first(struct seq_file *seq)
630 for (state->bucket = 0; state->bucket <= FL_HASH_MASK; ++state->bucket) { 631 for (state->bucket = 0; state->bucket <= FL_HASH_MASK; ++state->bucket) {
631 fl = fl_ht[state->bucket]; 632 fl = fl_ht[state->bucket];
632 633
633 while (fl && fl->fl_net != net) 634 while (fl && !net_eq(fl->fl_net, net))
634 fl = fl->next; 635 fl = fl->next;
635 if (fl) 636 if (fl)
636 break; 637 break;
@@ -645,7 +646,7 @@ static struct ip6_flowlabel *ip6fl_get_next(struct seq_file *seq, struct ip6_flo
645 646
646 fl = fl->next; 647 fl = fl->next;
647try_again: 648try_again:
648 while (fl && fl->fl_net != net) 649 while (fl && !net_eq(fl->fl_net, net))
649 fl = fl->next; 650 fl = fl->next;
650 651
651 while (!fl) { 652 while (!fl) {
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 1cf3f0c6a95..4c7a18abcaf 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -502,7 +502,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
502 if (event == NETLINK_URELEASE && 502 if (event == NETLINK_URELEASE &&
503 n->protocol == NETLINK_IP6_FW && n->pid) { 503 n->protocol == NETLINK_IP6_FW && n->pid) {
504 write_lock_bh(&queue_lock); 504 write_lock_bh(&queue_lock);
505 if ((n->net == &init_net) && (n->pid == peer_pid)) 505 if ((net_eq(n->net, &init_net)) && (n->pid == peer_pid))
506 __ipq_reset(); 506 __ipq_reset();
507 write_unlock_bh(&queue_lock); 507 write_unlock_bh(&queue_lock);
508 } 508 }
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index dce699fb267..45efc39753e 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -681,7 +681,7 @@ static int ip6_frags_ns_sysctl_register(struct net *net)
681 struct ctl_table_header *hdr; 681 struct ctl_table_header *hdr;
682 682
683 table = ip6_frags_ns_ctl_table; 683 table = ip6_frags_ns_ctl_table;
684 if (net != &init_net) { 684 if (!net_eq(net, &init_net)) {
685 table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL); 685 table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL);
686 if (table == NULL) 686 if (table == NULL)
687 goto err_alloc; 687 goto err_alloc;
@@ -699,7 +699,7 @@ static int ip6_frags_ns_sysctl_register(struct net *net)
699 return 0; 699 return 0;
700 700
701err_reg: 701err_reg:
702 if (net != &init_net) 702 if (!net_eq(net, &init_net))
703 kfree(table); 703 kfree(table);
704err_alloc: 704err_alloc:
705 return -ENOMEM; 705 return -ENOMEM;
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 975c5a366e5..f9759b54a6d 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1362,7 +1362,7 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol,
1362 int rc = -ESOCKTNOSUPPORT; 1362 int rc = -ESOCKTNOSUPPORT;
1363 struct sock *sk; 1363 struct sock *sk;
1364 1364
1365 if (net != &init_net) 1365 if (!net_eq(net, &init_net))
1366 return -EAFNOSUPPORT; 1366 return -EAFNOSUPPORT;
1367 1367
1368 /* 1368 /*
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 5266c286b26..3a66546cad0 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -158,7 +158,7 @@ static int llc_ui_create(struct net *net, struct socket *sock, int protocol,
158 if (!capable(CAP_NET_RAW)) 158 if (!capable(CAP_NET_RAW))
159 return -EPERM; 159 return -EPERM;
160 160
161 if (net != &init_net) 161 if (!net_eq(net, &init_net))
162 return -EAFNOSUPPORT; 162 return -EAFNOSUPPORT;
163 163
164 if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) { 164 if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) {
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index f900dc3194a..49005482e39 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -678,7 +678,7 @@ nfulnl_rcv_nl_event(struct notifier_block *this,
678 struct hlist_head *head = &instance_table[i]; 678 struct hlist_head *head = &instance_table[i];
679 679
680 hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) { 680 hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) {
681 if ((n->net == &init_net) && 681 if ((net_eq(n->net, &init_net)) &&
682 (n->pid == inst->peer_pid)) 682 (n->pid == inst->peer_pid))
683 __instance_destroy(inst); 683 __instance_destroy(inst);
684 } 684 }
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index eff5b0ddc5c..a4957bf2ca6 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1092,7 +1092,7 @@ static inline int do_one_set_err(struct sock *sk,
1092 if (sk == p->exclude_sk) 1092 if (sk == p->exclude_sk)
1093 goto out; 1093 goto out;
1094 1094
1095 if (sock_net(sk) != sock_net(p->exclude_sk)) 1095 if (!net_eq(sock_net(sk), sock_net(p->exclude_sk)))
1096 goto out; 1096 goto out;
1097 1097
1098 if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups || 1098 if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups ||
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 4bdd5697f63..71604c6613b 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -431,7 +431,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
431 struct sock *sk; 431 struct sock *sk;
432 struct nr_sock *nr; 432 struct nr_sock *nr;
433 433
434 if (net != &init_net) 434 if (!net_eq(net, &init_net))
435 return -EAFNOSUPPORT; 435 return -EAFNOSUPPORT;
436 436
437 if (sock->type != SOCK_SEQPACKET || protocol != 0) 437 if (sock->type != SOCK_SEQPACKET || protocol != 0)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index c620bd9ae3d..940fc20b2b5 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -365,7 +365,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev,
365 if (skb->pkt_type == PACKET_LOOPBACK) 365 if (skb->pkt_type == PACKET_LOOPBACK)
366 goto out; 366 goto out;
367 367
368 if (dev_net(dev) != sock_net(sk)) 368 if (!net_eq(dev_net(dev), sock_net(sk)))
369 goto out; 369 goto out;
370 370
371 skb = skb_share_check(skb, GFP_ATOMIC); 371 skb = skb_share_check(skb, GFP_ATOMIC);
@@ -553,7 +553,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
553 sk = pt->af_packet_priv; 553 sk = pt->af_packet_priv;
554 po = pkt_sk(sk); 554 po = pkt_sk(sk);
555 555
556 if (dev_net(dev) != sock_net(sk)) 556 if (!net_eq(dev_net(dev), sock_net(sk)))
557 goto drop; 557 goto drop;
558 558
559 skb->dev = dev; 559 skb->dev = dev;
@@ -674,7 +674,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
674 sk = pt->af_packet_priv; 674 sk = pt->af_packet_priv;
675 po = pkt_sk(sk); 675 po = pkt_sk(sk);
676 676
677 if (dev_net(dev) != sock_net(sk)) 677 if (!net_eq(dev_net(dev), sock_net(sk)))
678 goto drop; 678 goto drop;
679 679
680 if (dev->header_ops) { 680 if (dev->header_ops) {
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 4de4287fec3..8feb9e5d662 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -518,7 +518,7 @@ static int rose_create(struct net *net, struct socket *sock, int protocol,
518 struct sock *sk; 518 struct sock *sk;
519 struct rose_sock *rose; 519 struct rose_sock *rose;
520 520
521 if (net != &init_net) 521 if (!net_eq(net, &init_net))
522 return -EAFNOSUPPORT; 522 return -EAFNOSUPPORT;
523 523
524 if (sock->type != SOCK_SEQPACKET || protocol != 0) 524 if (sock->type != SOCK_SEQPACKET || protocol != 0)
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index f978d02a248..287b1415cee 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -616,7 +616,7 @@ static int rxrpc_create(struct net *net, struct socket *sock, int protocol,
616 616
617 _enter("%p,%d", sock, protocol); 617 _enter("%p,%d", sock, protocol);
618 618
619 if (net != &init_net) 619 if (!net_eq(net, &init_net))
620 return -EAFNOSUPPORT; 620 return -EAFNOSUPPORT;
621 621
622 /* we support transport protocol UDP only */ 622 /* we support transport protocol UDP only */
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ca2e1fd2bf6..2a740035aa6 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -969,7 +969,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
969 u32 pid = skb ? NETLINK_CB(skb).pid : 0; 969 u32 pid = skb ? NETLINK_CB(skb).pid : 0;
970 int ret = 0, ovr = 0; 970 int ret = 0, ovr = 0;
971 971
972 if (net != &init_net) 972 if (!net_eq(net, &init_net))
973 return -EINVAL; 973 return -EINVAL;
974 974
975 ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL); 975 ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL);
@@ -1052,7 +1052,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
1052 struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh); 1052 struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh);
1053 struct nlattr *kind = find_dump_kind(cb->nlh); 1053 struct nlattr *kind = find_dump_kind(cb->nlh);
1054 1054
1055 if (net != &init_net) 1055 if (!net_eq(net, &init_net))
1056 return 0; 1056 return 0;
1057 1057
1058 if (kind == NULL) { 1058 if (kind == NULL) {
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index c024da77824..3725d8fa29d 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -137,7 +137,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
137 int err; 137 int err;
138 int tp_created = 0; 138 int tp_created = 0;
139 139
140 if (net != &init_net) 140 if (!net_eq(net, &init_net))
141 return -EINVAL; 141 return -EINVAL;
142 142
143replay: 143replay:
@@ -418,7 +418,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
418 const struct Qdisc_class_ops *cops; 418 const struct Qdisc_class_ops *cops;
419 struct tcf_dump_args arg; 419 struct tcf_dump_args arg;
420 420
421 if (net != &init_net) 421 if (!net_eq(net, &init_net))
422 return 0; 422 return 0;
423 423
424 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) 424 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 876ba4bb6ae..75fd1c672c6 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -947,7 +947,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
947 struct Qdisc *p = NULL; 947 struct Qdisc *p = NULL;
948 int err; 948 int err;
949 949
950 if (net != &init_net) 950 if (!net_eq(net, &init_net))
951 return -EINVAL; 951 return -EINVAL;
952 952
953 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) 953 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
@@ -1009,7 +1009,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1009 struct Qdisc *q, *p; 1009 struct Qdisc *q, *p;
1010 int err; 1010 int err;
1011 1011
1012 if (net != &init_net) 1012 if (!net_eq(net, &init_net))
1013 return -EINVAL; 1013 return -EINVAL;
1014 1014
1015replay: 1015replay:
@@ -1274,7 +1274,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
1274 int s_idx, s_q_idx; 1274 int s_idx, s_q_idx;
1275 struct net_device *dev; 1275 struct net_device *dev;
1276 1276
1277 if (net != &init_net) 1277 if (!net_eq(net, &init_net))
1278 return 0; 1278 return 0;
1279 1279
1280 s_idx = cb->args[0]; 1280 s_idx = cb->args[0];
@@ -1334,7 +1334,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1334 u32 qid = TC_H_MAJ(clid); 1334 u32 qid = TC_H_MAJ(clid);
1335 int err; 1335 int err;
1336 1336
1337 if (net != &init_net) 1337 if (!net_eq(net, &init_net))
1338 return -EINVAL; 1338 return -EINVAL;
1339 1339
1340 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) 1340 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
@@ -1576,7 +1576,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
1576 struct net_device *dev; 1576 struct net_device *dev;
1577 int t, s_t; 1577 int t, s_t;
1578 1578
1579 if (net != &init_net) 1579 if (!net_eq(net, &init_net))
1580 return 0; 1580 return 0;
1581 1581
1582 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) 1582 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index d00c2119faf..eca5eb0dab0 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -195,7 +195,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
195 195
196 /* Validate arguments */ 196 /* Validate arguments */
197 197
198 if (net != &init_net) 198 if (!net_eq(net, &init_net))
199 return -EAFNOSUPPORT; 199 return -EAFNOSUPPORT;
200 200
201 if (unlikely(protocol != 0)) 201 if (unlikely(protocol != 0))
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index ac7dba46fa3..2a3a513af3c 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -514,7 +514,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol,
514 struct x25_sock *x25; 514 struct x25_sock *x25;
515 int rc = -ESOCKTNOSUPPORT; 515 int rc = -ESOCKTNOSUPPORT;
516 516
517 if (net != &init_net) 517 if (!net_eq(net, &init_net))
518 return -EAFNOSUPPORT; 518 return -EAFNOSUPPORT;
519 519
520 if (sock->type != SOCK_SEQPACKET || protocol) 520 if (sock->type != SOCK_SEQPACKET || protocol)