netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: sched: Fix warnings from xchg() on RCU'd cookie pointer.
@ 2018-07-08  8:03 David Miller
  2018-07-09 15:30 ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2018-07-08  8:03 UTC (permalink / raw)
  To: netdev; +Cc: vladbu, jiri


The kbuild test robot reports:

>> net/sched/act_api.c:71:15: sparse: incorrect type in initializer (different address spaces) @@    expected struct tc_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
>> net/sched/act_api.c:71:13: sparse: incorrect type in assignment (different address spaces) @@    expected struct tc_cookie *old @@    got struct tc_cookie [noderef] <struct tc_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
>> 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.

Fixes: eec94fdb0480 ("net: sched: use rcu for action cookie update")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/sched/act_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index bf1c35f3deb6..66dc19746c63 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -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);
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: sched: Fix warnings from xchg() on RCU'd cookie pointer.
  2018-07-08  8:03 [PATCH] net: sched: Fix warnings from xchg() on RCU'd cookie pointer David Miller
@ 2018-07-09 15:30 ` Marcelo Ricardo Leitner
  2018-07-09 17:29   ` Vlad Buslov
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2018-07-09 15:30 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, vladbu, jiri

On Sun, Jul 08, 2018 at 05:03:58PM +0900, David Miller wrote:
> 
> The kbuild test robot reports:
> 
> >> net/sched/act_api.c:71:15: sparse: incorrect type in initializer (different address spaces) @@    expected struct tc_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
> >> net/sched/act_api.c:71:13: sparse: incorrect type in assignment (different address spaces) @@    expected struct tc_cookie *old @@    got struct tc_cookie [noderef] <struct tc_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

This one:

> >> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: sched: Fix warnings from xchg() on RCU'd cookie pointer.
  2018-07-09 15:30 ` Marcelo Ricardo Leitner
@ 2018-07-09 17:29   ` Vlad Buslov
  0 siblings, 0 replies; 3+ messages in thread
From: Vlad Buslov @ 2018-07-09 17:29 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner; +Cc: David Miller, netdev, jiri


On Mon 09 Jul 2018 at 15:30, Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> wrote:
> On Sun, Jul 08, 2018 at 05:03:58PM +0900, David Miller wrote:
>> 
>> The kbuild test robot reports:
>> 
>> >> net/sched/act_api.c:71:15: sparse: incorrect type in initializer (different address spaces) @@    expected struct tc_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
>> >> net/sched/act_api.c:71:13: sparse: incorrect type in assignment (different address spaces) @@    expected struct tc_cookie *old @@    got struct tc_cookie [noderef] <struct tc_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
>
> This one:
>
>> >> 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

Thanks,

I've sent the fix.

Vlad

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-09 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-08  8:03 [PATCH] net: sched: Fix warnings from xchg() on RCU'd cookie pointer David Miller
2018-07-09 15:30 ` Marcelo Ricardo Leitner
2018-07-09 17:29   ` Vlad Buslov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).