rculist: Fix another sparse warning
PATCH v2 1/1 rculist: Fix another sparse warning
This fixes the following sparse warnings:
make C=1 CF=-D__CHECK_ENDIAN__ net/tipc/name_table.onet/tipc/name_table.c:977:17: error: incompatible types in comparison expression (different address spaces) net/tipc/name_table.c:977:17: error: incompatible types in comparison expression (different address spaces)
To silence these spare complaints, an RCU annotation should be added to "next" pointer of hlist_node structure through hlist_next_rcu() macro when iterating over a hlist with hlist_for_each_entry_from_rcu().
---
Changes:
- Replace rcu_dereference_bh() with rcu_dereference_raw() suggested by Paul.
include/linux/rculist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/rculist.h +2 -2
@@ -549,8 +549,8 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,*/ #define hlist_for_each_entry_from_rcu (pos, member) \ for (; pos; \ - pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\ - typeof(*(pos)), member)) + pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \ + &(pos)->member)), typeof(*(pos)), member))#endif /* __KERNEL__ */ #endif
Signature · 1 line
1.7.9.5
Quoted 11 lines · Ying Xue
This fixes the following sparse warnings:
make C=1 CF=-D__CHECK_ENDIAN__
net/tipc/name_table.onet/tipc/name_table.c:977:17: error: incompatible types in comparison expression (different address spaces)net/tipc/name_table.c:977:17: error: incompatible types in comparison expression (different address spaces)To silence these spare complaints, an RCU annotation should be added to "next" pointer of
hlist_nodestructure throughhlist_next_rcu()macro when iterating over a hlist withhlist_for_each_entry_from_rcu().Signed-off-by Ying Xue <[email protected]>
Queued for testing, thank you!
If testing goes well, I will push it into the 4.3 merge window.
Thanx, Paul
Quoted 26 lines
---
Changes:
- Replacercu_dereference_bh()withrcu_dereference_raw()suggested by Paul.include/linux/rculist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/rculist.h +2
-2@@ -549,8 +549,8 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,*/ #define hlist_for_each_entry_from_rcu (pos, member) \ for (; pos; \ - pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\ - typeof(*(pos)), member)) + pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \ + &(pos)->member)), typeof(*(pos)), member))#endif /* __KERNEL__ */ #endif Signature · 1 line
1.7.9.5