diff options
author | Tejun Heo <tj@kernel.org> | 2010-02-16 10:20:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-17 02:05:38 -0500 |
commit | 7d720c3e4f0c4fc152a6bf17e24244a3c85412d2 (patch) | |
tree | 36e037187ce79acb211702bea22e99c625787757 /net/ipv6/af_inet6.c | |
parent | 2bb4646fce8d09916b351d1a62f98db7cec6fc41 (diff) |
percpu: add __percpu sparse annotations to net
Add __percpu sparse annotations to net.
These annotations are to make sparse consider percpu variables to be
in a different address space and warn if accessed without going
through percpu accessors. This patch doesn't affect normal builds.
The macro and type tricks around snmp stats make things a bit
interesting. DEFINE/DECLARE_SNMP_STAT() macros mark the target field
as __percpu and SNMP_UPD_PO_STATS() macro is updated accordingly. All
snmp_mib_*() users which used to cast the argument to (void **) are
updated to cast it to (void __percpu **).
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r-- | net/ipv6/af_inet6.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index e29160ff4a0f..37d14e735c27 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -971,41 +971,41 @@ static void ipv6_packet_cleanup(void) | |||
971 | 971 | ||
972 | static int __net_init ipv6_init_mibs(struct net *net) | 972 | static int __net_init ipv6_init_mibs(struct net *net) |
973 | { | 973 | { |
974 | if (snmp_mib_init((void **)net->mib.udp_stats_in6, | 974 | if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6, |
975 | sizeof (struct udp_mib)) < 0) | 975 | sizeof (struct udp_mib)) < 0) |
976 | return -ENOMEM; | 976 | return -ENOMEM; |
977 | if (snmp_mib_init((void **)net->mib.udplite_stats_in6, | 977 | if (snmp_mib_init((void __percpu **)net->mib.udplite_stats_in6, |
978 | sizeof (struct udp_mib)) < 0) | 978 | sizeof (struct udp_mib)) < 0) |
979 | goto err_udplite_mib; | 979 | goto err_udplite_mib; |
980 | if (snmp_mib_init((void **)net->mib.ipv6_statistics, | 980 | if (snmp_mib_init((void __percpu **)net->mib.ipv6_statistics, |
981 | sizeof(struct ipstats_mib)) < 0) | 981 | sizeof(struct ipstats_mib)) < 0) |
982 | goto err_ip_mib; | 982 | goto err_ip_mib; |
983 | if (snmp_mib_init((void **)net->mib.icmpv6_statistics, | 983 | if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics, |
984 | sizeof(struct icmpv6_mib)) < 0) | 984 | sizeof(struct icmpv6_mib)) < 0) |
985 | goto err_icmp_mib; | 985 | goto err_icmp_mib; |
986 | if (snmp_mib_init((void **)net->mib.icmpv6msg_statistics, | 986 | if (snmp_mib_init((void __percpu **)net->mib.icmpv6msg_statistics, |
987 | sizeof(struct icmpv6msg_mib)) < 0) | 987 | sizeof(struct icmpv6msg_mib)) < 0) |
988 | goto err_icmpmsg_mib; | 988 | goto err_icmpmsg_mib; |
989 | return 0; | 989 | return 0; |
990 | 990 | ||
991 | err_icmpmsg_mib: | 991 | err_icmpmsg_mib: |
992 | snmp_mib_free((void **)net->mib.icmpv6_statistics); | 992 | snmp_mib_free((void __percpu **)net->mib.icmpv6_statistics); |
993 | err_icmp_mib: | 993 | err_icmp_mib: |
994 | snmp_mib_free((void **)net->mib.ipv6_statistics); | 994 | snmp_mib_free((void __percpu **)net->mib.ipv6_statistics); |
995 | err_ip_mib: | 995 | err_ip_mib: |
996 | snmp_mib_free((void **)net->mib.udplite_stats_in6); | 996 | snmp_mib_free((void __percpu **)net->mib.udplite_stats_in6); |
997 | err_udplite_mib: | 997 | err_udplite_mib: |
998 | snmp_mib_free((void **)net->mib.udp_stats_in6); | 998 | snmp_mib_free((void __percpu **)net->mib.udp_stats_in6); |
999 | return -ENOMEM; | 999 | return -ENOMEM; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static void ipv6_cleanup_mibs(struct net *net) | 1002 | static void ipv6_cleanup_mibs(struct net *net) |
1003 | { | 1003 | { |
1004 | snmp_mib_free((void **)net->mib.udp_stats_in6); | 1004 | snmp_mib_free((void __percpu **)net->mib.udp_stats_in6); |
1005 | snmp_mib_free((void **)net->mib.udplite_stats_in6); | 1005 | snmp_mib_free((void __percpu **)net->mib.udplite_stats_in6); |
1006 | snmp_mib_free((void **)net->mib.ipv6_statistics); | 1006 | snmp_mib_free((void __percpu **)net->mib.ipv6_statistics); |
1007 | snmp_mib_free((void **)net->mib.icmpv6_statistics); | 1007 | snmp_mib_free((void __percpu **)net->mib.icmpv6_statistics); |
1008 | snmp_mib_free((void **)net->mib.icmpv6msg_statistics); | 1008 | snmp_mib_free((void __percpu **)net->mib.icmpv6msg_statistics); |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | static int __net_init inet6_net_init(struct net *net) | 1011 | static int __net_init inet6_net_init(struct net *net) |