[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c5111b2af20d30e8f5da12002eb3c5d7293413e1.1407939963.git.tgraf@suug.ch>
Date: Wed, 13 Aug 2014 16:38:31 +0200
From: Thomas Graf <tgraf@...g.ch>
To: netdev@...r.kernel.org
Subject: [PATCH 3/4] rhashtable: fix annotations for rht_for_each_entry_rcu()
Call rcu_deference_raw() directly from within rht_for_each_entry_rcu()
as list_for_each_entry_rcu() does.
Fixes the following sparse warnings:
net/netlink/af_netlink.c:2906:25: expected struct rhash_head const *__mptr
net/netlink/af_netlink.c:2906:25: got struct rhash_head [noderef] <asn:4>*<noident>
Fixes: e341694e3eb57fc ("netlink: Convert netlink_lookup() to use RCU protected hash table")
Signed-off-by: Thomas Graf <tgraf@...g.ch>
---
include/linux/rhashtable.h | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index af967c4..36826c0 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -123,11 +123,6 @@ void rhashtable_destroy(const struct rhashtable *ht);
typeof(ptr) __ptr = (ptr); \
__ptr ? rht_entry(__ptr, type, member) : NULL; \
})
-#define rht_entry_safe_rcu(ptr, type, member) \
-({ \
- typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \
- __ptr ? container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member) : NULL; \
-})
#define rht_next_entry_safe(pos, ht, member) \
({ \
@@ -204,9 +199,10 @@ void rhashtable_destroy(const struct rhashtable *ht);
* traversal is guarded by rcu_read_lock().
*/
#define rht_for_each_entry_rcu(pos, head, member) \
- for (pos = rht_entry_safe_rcu(head, typeof(*(pos)), member); \
+ for (pos = rht_entry_safe(rcu_dereference_raw(head), \
+ typeof(*(pos)), member); \
pos; \
- pos = rht_entry_safe_rcu((pos)->member.next, \
- typeof(*(pos)), member))
+ pos = rht_entry_safe(rcu_dereference_raw((pos)->member.next), \
+ typeof(*(pos)), member))
#endif /* _LINUX_RHASHTABLE_H */
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists