Skip to contentSkip to conversation

net: fix some RCU warnings in various places

PATCH Superseded Cong Wang 2 participants 3 messages Feb 16, 2013

Subsystems (5)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH v3 1/1 net: fix some RCU warnings in various places

From: Cong Wang <[email protected]>

This fixes sparse warnings like the one below:

drivers/net/team/team.c:953:25: warning: incorrect type in return expression (different address spaces)
drivers/net/team/team.c:953:25: expected struct netpoll_info *
drivers/net/team/team.c:953:25: got struct netpoll_info [noderef] <asn:4>*npinfo

Cc Eric Dumazet <[email protected]>
Cc Jiri Pirko <[email protected]>
Cc Vlad Yasevich <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc David S. Miller <[email protected]>

---

drivers/net/bonding/bond_main.c +1 -1
index 94c1534..71ad0f2 100644
@@ -1302,7 +1302,7 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, g
 
 static struct netpoll_info *bond_netpoll_info(struct bonding *bond)
 {
-	return bond->dev->npinfo;
+	return rcu_access_pointer(bond->dev->npinfo);
 }
 
 #else
drivers/net/team/team.c +1 -1
index 05c5efe..03e5949 100644
@@ -950,7 +950,7 @@ static void team_port_disable_netpoll(struct team_port *port)
 
 static struct netpoll_info *team_netpoll_info(struct team *team)
 {
-	return team->dev->npinfo;
+	return rcu_access_pointer(team->dev->npinfo);
 }
 
 #else
net/bridge/br_private.h +2 -2
index 6d314c4..0aa1b84 100644
@@ -330,7 +330,7 @@ extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
 {
-	return br->dev->npinfo;
+	return rcu_access_pointer(br->dev->npinfo);
 }
 
 static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
@@ -469,7 +469,7 @@ extern void br_multicast_free_pg(struct rcu_head *head);
 extern struct net_bridge_port_group *br_multicast_new_port_group(
 				struct net_bridge_port *port,
 				struct br_ip *group,
-				struct net_bridge_port_group *next,
+				struct net_bridge_port_group __rcu *next,
 				unsigned char state);
 extern void br_mdb_init(void);
 extern void br_mdb_uninit(void);
#1 lore raw
Quoted 6 lines · Cong Wang

From: Cong Wang <[email protected]>

This fixes sparse warnings like the one below:

static inline void br_netpoll_send_skb(const struct net_bridge_port *p,

net/bridge/br_private.h extern void br_multicast_free_pg(struct rcu_head *head); · line 475

Quoted 8 lines
net/bridge/br_private.h +1 -1
@@ -469,7 +469,7 @@ extern void br_multicast_free_pg(struct rcu_head *head);
 extern struct net_bridge_port_group *br_multicast_new_port_group(
 				struct net_bridge_port *port,
 				struct br_ip *group,
-				struct net_bridge_port_group *next,
+				struct net_bridge_port_group __rcu *next,
 				unsigned char state);
 extern void br_mdb_init(void);
 extern void br_mdb_uninit(void);

This part is wrong, please remove the __rcu annotation in function definition.

To perform " rcu_assign_pointer(p->next, next); ", there is no need to annotate "next" with __rcu

author
#2 lore raw
Quoted 19 lines · Eric Dumazet
Quoted 6 lines · Cong Wang

From: Cong Wang <[email protected]>

This fixes sparse warnings like the one below:

static inline void br_netpoll_send_skb(const struct net_bridge_port *p,

net/bridge/br_private.h extern void br_multicast_free_pg(struct rcu_head *head); · line 475

Quoted 8 lines
net/bridge/br_private.h +1 -1
@@ -469,7 +469,7 @@ extern void br_multicast_free_pg(struct rcu_head *head);
 extern struct net_bridge_port_group *br_multicast_new_port_group(
 				struct net_bridge_port *port,
 				struct br_ip *group,
-				struct net_bridge_port_group *next,
+				struct net_bridge_port_group __rcu *next,
 				unsigned char state);
 extern void br_mdb_init(void);
 extern void br_mdb_uninit(void);

This part is wrong, please remove the __rcu annotation in function definition.

Quoted 3 lines

To perform " rcu_assign_pointer(p->next, next); ", there is no need to annotate "next" with __rcu

This will introduce more warnings, enjoy. ;)

So I will leave this to Vlad.

Thanks.