[PATCH] xfrm: Fix incorrect types in assignment

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

STALE2001d

2 messages, 2 authors, 2021-02-19 · open the first message on its own page

[PATCH] xfrm: Fix incorrect types in assignment

From: Yang Li <hidden>
Date: 2021-02-19 09:50:27

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b74f28c..5c67407 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -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;
-- 
1.8.3.1

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

From: Florian Westphal <fw@strlen.de>
Date: 2021-02-19 14:03:14

Yang Li [off-list ref] wrote:
quoted hunk
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b74f28c..5c67407 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -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));
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help