[PATCH v2] xfrm: Fix incorrect types in assignment

Subsystems: networking [general], networking [ipsec], the rest

STALE1984d

2 messages, 2 authors, 2021-03-01 · open the first message on its own page

[PATCH v2] xfrm: Fix incorrect types in assignment

From: Yang Li <hidden>
Date: 2021-02-20 03:19:18

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

Reported-by: Abaci Robot <redacted>
Signed-off-by: Yang Li <redacted>
---
 net/xfrm/xfrm_policy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b74f28c..aac5e88 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -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);
-- 
1.8.3.1

Re: [PATCH v2] xfrm: Fix incorrect types in assignment

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: 2021-03-01 11:34:17

On Sat, Feb 20, 2021 at 11:18:23AM +0800, Yang Li wrote:
Fix the following sparse warnings:
net/xfrm/xfrm_policy.c:1303:22: warning: incorrect type in assignment
(different address spaces)

Reported-by: Abaci Robot <redacted>
Signed-off-by: Yang Li <redacted>
Please add a proper 'Fixes' tag so that it can be backported into
the stable trees.

Thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help