Skip to contentSkip to conversation

xfrm: Fix incorrect types in assignment

PATCH Superseded Yang Li 2 participants 2 messages Feb 19, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 xfrm: Fix incorrect types in assignment

Fix the following sparse warnings:
net/xfrm/xfrm_policy.c:1303:22: warning: incorrect type in assignment (different address spaces)

---
 net/xfrm/xfrm_policy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +1 -1
index b74f28c..5c67407 100644
@@ -1225,7 +1225,7 @@ static void xfrm_hash_rebuild(struct work_struct *work)
 	struct xfrm_policy *pol;
 	struct xfrm_policy *policy;
 	struct hlist_head *chain;
-	struct hlist_head *odst;
+	struct hlist_head __rcu *odst;
 	struct hlist_node *newpos;
 	int i;
 	int dir;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 14 lines · Yang Li

Fix the following sparse warnings:
net/xfrm/xfrm_policy.c:1303:22: warning: incorrect type in assignment (different address spaces)

---
 net/xfrm/xfrm_policy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +0 -0
index b74f28c..5c67407 100644

net/xfrm/xfrm_policy.c static void xfrm_hash_rebuild(struct work_struct *work) · line 1228

Quoted 5 lines
net/xfrm/xfrm_policy.c +1 -1
@@ -1225,7 +1225,7 @@ static void xfrm_hash_rebuild(struct work_struct *work)
 	struct xfrm_policy *pol;
 	struct xfrm_policy *policy;
 	struct hlist_head *chain;
-	struct hlist_head *odst;
+	struct hlist_head __rcu *odst;

This doesn't look right. Try something like

- odst = net->xfrm.policy_bydst[dir].table;
+ odst = rcu_dereference_protected(net->xfrm.policy_bydst[dir].table,

			           lockdep_is_held(&net->xfrm.xfrm_policy_lock));