Skip to contentSkip to conversation

xfrm: Fix incorrect types in assignment

PATCH In review Yang Li 2 participants 2 messages Feb 20, 2021 – Mar 1, 2021

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH v2 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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +2 -1
index b74f28c..aac5e88 100644
@@ -1300,7 +1300,8 @@ static void xfrm_hash_rebuild(struct work_struct *work)
 		}
 
 		hmask = net->xfrm.policy_bydst[dir].hmask;
-		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));
 		for (i = hmask; i >= 0; i--) {
 			hlist_for_each_entry_safe(policy, n, odst + i, bydst)
 				hlist_del_rcu(&policy->bydst);
Signature · 1 line
1.8.3.1