net/sock: Update sk rcu iterator macro.
authorTim Hansen <devtimhansen@gmail.com>
Mon, 23 Oct 2017 19:35:58 +0000 (15:35 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Oct 2017 09:46:22 +0000 (18:46 +0900)
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.

Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h

index 4827094..6f1be97 100644 (file)
@@ -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)
 {