]> git.baikalelectronics.ru Git - kernel.git/commit
hlist_add_tail_rcu disable sparse warning
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 27 Feb 2017 19:14:19 +0000 (21:14 +0200)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 19 Apr 2017 16:29:18 +0000 (09:29 -0700)
commit0bcc86d005d135d858d8f85ce856b77c15fc5262
tree4a44a13177bcdb5e513bda83d830480e4b26262b
parent7d51ec29d46336c4f4ad2e5c391ae996e762520d
hlist_add_tail_rcu disable sparse warning

sparse is unhappy about this code in hlist_add_tail_rcu:

        struct hlist_node *i, *last = NULL;

        for (i = hlist_first_rcu(h); i; i = hlist_next_rcu(i))
                last = i;

This is because hlist_next_rcu and hlist_next_rcu return
__rcu pointers.

It's a false positive - it's a write side primitive and so
does not need to be called in a read side critical section.

The following trivial patch disables the warning
without changing the behaviour in any way.

Note: __hlist_for_each_rcu would also remove the warning but it would be
confusing since it calls rcu_derefence and is designed to run in the rcu
read side critical section.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
include/linux/rculist.h