Skip to content

Commit

Permalink
ipv6: raw: rcu annotations
Browse files Browse the repository at this point in the history
Remove sparse warnings, using a function typedef to be able to use __rcu
annotation on mh_filter pointer.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 21, 2011
1 parent 6193d2b commit f2eda47
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions net/ipv6/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ static __inline__ int icmpv6_filter(struct sock *sk, struct sk_buff *skb)
}

#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
static int (*mh_filter)(struct sock *sock, struct sk_buff *skb);
typedef int mh_filter_t(struct sock *sock, struct sk_buff *skb);

int rawv6_mh_filter_register(int (*filter)(struct sock *sock,
struct sk_buff *skb))
static mh_filter_t __rcu *mh_filter __read_mostly;

int rawv6_mh_filter_register(mh_filter_t filter)
{
rcu_assign_pointer(mh_filter, filter);
return 0;
}
EXPORT_SYMBOL(rawv6_mh_filter_register);

int rawv6_mh_filter_unregister(int (*filter)(struct sock *sock,
struct sk_buff *skb))
int rawv6_mh_filter_unregister(mh_filter_t filter)
{
rcu_assign_pointer(mh_filter, NULL);
synchronize_rcu();
Expand Down Expand Up @@ -192,10 +192,10 @@ static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
* policy is placed in rawv6_rcv() because it is
* required for each socket.
*/
int (*filter)(struct sock *sock, struct sk_buff *skb);
mh_filter_t *filter;

filter = rcu_dereference(mh_filter);
filtered = filter ? filter(sk, skb) : 0;
filtered = filter ? (*filter)(sk, skb) : 0;
break;
}
#endif
Expand Down

0 comments on commit f2eda47

Please sign in to comment.