Skip to contentSkip to conversation

net/sock: Update sk rcu iterator macro.

PATCH Applied Tim Hansen 2 participants 2 messages Oct 23, 2017 – Oct 24, 2017

Subsystems (3)
lore
Share & tools
lore

Tim Hansen

author
#0 lore raw

PATCH v3 1/1 net/sock: Update sk rcu iterator macro.

Mark hlist node in sk rcu iterator as protected by the rcu. hlist_next_rcu accomplishes this and silences the warnings sparse throws.

Found with make C=1 net/ipv4/udp.o on linux-next tag next-20171009.

---
 include/net/sock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/sock.h +2 -2
index 64e5ac41b9cf..14c73e8187a6 100644
@@ -737,10 +737,10 @@ static inline void sk_add_bind_node(struct sock *sk,
  *
  */
 #define sk_for_each_entry_offset_rcu(tpos, pos, head, offset)		       \
-	for (pos = rcu_dereference((head)->first);			       \
+	for (pos = rcu_dereference(hlist_first_rcu(head));		       \
 	     pos != NULL &&						       \
 		({ tpos = (typeof(*tpos) *)((void *)pos - offset); 1;});       \
-	     pos = rcu_dereference(pos->next))
+	     pos = rcu_dereference(hlist_next_rcu(pos)))
 
 static inline struct user_namespace *sk_user_ns(struct sock *sk)
 {
Signature · 1 line
2.15.0.rc0
maintainer Applied
#1 lore raw

From: Tim Hansen <[email protected]>
Date: Mon, 23 Oct 2017 15:35:58 -0400

Quoted 8 lines

Mark hlist node in sk rcu iterator as protected by the rcu. hlist_next_rcu accomplishes this and silences the warnings sparse throws.

Found with make C=1 net/ipv4/udp.o on linux-next tag next-20171009.

Applied.