net: sched: Fix warnings from xchg() on RCU'd cookie pointer.
Subsystems (3)
David Miller
maintainerPATCH 1/1 net: sched: Fix warnings from xchg() on RCU'd cookie pointer.
The kbuild test robot reports:
Quoted 1 line
Quoted 1 line
net/sched/act_api.c:71:15: sparse: incorrect type in initializer (different address spaces) @@ expected structtc_cookie[noderef] <asn:4>*__ret @@ got [noderef] <asn:4>*__ret @@
net/sched/act_api.c:71:15: expected struct tc_cookie [noderef] <asn:4>*__ret
net/sched/act_api.c:71:15: got struct tc_cookie *new_cookie
Quoted 1 line
Quoted 1 line
net/sched/act_api.c:71:13: sparse: incorrect type in assignment (different address spaces) @@ expected structtc_cookie*old @@ got structtc_cookie[noderef] <structtc_cookie*old @@
net/sched/act_api.c:71:13: expected struct tc_cookie *old
net/sched/act_api.c:71:13: got struct tc_cookie [noderef] <asn:4>*[assigned] __ret
Quoted 1 line
Quoted 1 line
net/sched/act_api.c:132:48: sparse: dereference of noderef expression
Handle this in the usual way by force casting away the __rcu annotation when we are using xchg() on it.
--- net/sched/act_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_api.c +1 -1
@@ -68,7 +68,7 @@ static void tcf_set_action_cookie(struct tc_cookie __rcu **old_cookie, {struct tc_cookie *old; - old =xchg (old_cookie, new_cookie); + old =xchg ((__force struct tc_cookie **)old_cookie, new_cookie);if (old)call_rcu (&old->rcu, tcf_free_cookie_rcu); }
Signature · 1 line
2.17.1
Quoted 9 lines · David Miller
The kbuild test robot reports:
Quoted 1 line
Quoted 1 line
net/sched/act_api.c:71:15: sparse: incorrect type in initializer (different address spaces) @@ expected structtc_cookie[noderef] <asn:4>*__ret @@ got [noderef] <asn:4>*__ret @@
net/sched/act_api.c:71:15: expected structtc_cookie[noderef] <asn:4>*__ret
net/sched/act_api.c:71:15: got structtc_cookie*new_cookieQuoted 1 line
Quoted 1 line
net/sched/act_api.c:71:13: sparse: incorrect type in assignment (different address spaces) @@ expected structtc_cookie*old @@ got structtc_cookie[noderef] <structtc_cookie*old @@
net/sched/act_api.c:71:13: expected structtc_cookie*old
net/sched/act_api.c:71:13: got structtc_cookie[noderef] <asn:4>*[assigned]__ret
This one:
Quoted 1 line
Quoted 1 line
Quoted 1 line
net/sched/act_api.c:132:48: sparse: dereference of noderef expression
Actually belongs to a different issue, that was reported in the same email, but which wasn't handled in this patch.
Marcelo
Quoted 11 lines · Marcelo Ricardo Leitner
Quoted 9 lines · David Miller
The kbuild test robot reports:
Quoted 1 line
Quoted 1 line
net/sched/act_api.c:71:15: sparse: incorrect type in initializer (different address spaces) @@ expected structtc_cookie[noderef] <asn:4>*__ret @@ got [noderef] <asn:4>*__ret @@
net/sched/act_api.c:71:15: expected structtc_cookie[noderef] <asn:4>*__ret
net/sched/act_api.c:71:15: got structtc_cookie*new_cookieQuoted 1 line
Quoted 1 line
net/sched/act_api.c:71:13: sparse: incorrect type in assignment (different address spaces) @@ expected structtc_cookie*old @@ got structtc_cookie[noderef] <structtc_cookie*old @@
net/sched/act_api.c:71:13: expected structtc_cookie*old
net/sched/act_api.c:71:13: got structtc_cookie[noderef] <asn:4>*[assigned]__ret
Quoted 8 lines
This one:
Quoted 1 line
Quoted 1 line
Quoted 1 line
net/sched/act_api.c:132:48: sparse: dereference of noderef expressionActually belongs to a different issue, that was reported in the same email, but which wasn't handled in this patch.
Marcelo
Thanks,
I've sent the fix.
Vlad