]> asedeno.scripts.mit.edu Git - linux.git/commit
rcu: Add sparse check to rcu_assign_pointer()
authorJoel Fernandes (Google) <joel@joelfernandes.org>
Wed, 12 Dec 2018 22:37:10 +0000 (14:37 -0800)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Fri, 25 Jan 2019 23:35:24 +0000 (15:35 -0800)
commit423a86a610cad121742ebe698ef98a3b4c87b5dd
tree9117e80180d67b87476ba360d5f19505c783ae55
parentc2d8089de7f0b849af11c271278fe6b904db5df2
rcu: Add sparse check to rcu_assign_pointer()

The rcu_assign_pointer() function currently doesn't do any sparse checking
on the assigned-to pointer.  So its possible that a pointer that is
not __rcu annotated is assigned with rcu_assign_pointer without sparse
complaints.  Because rcu_dereference() already does such checking,
this commit makes rcu_assign_pointer() to do the same. The extra
error could be helpful in cases where an RCU pointer is assigned with
rcu_assign_pointer() but not annotated with __rcu.

This doesn't generate any code in the normal case because __CHECKER__ is
defined only in the context of sparse.

This commit also renames rcu_dereference_sparse() to rcu_check_parse()
since the checking now happens not only during derereferencing but also
during assignment.

Test: Introduced an rcu_assign_pointer in code and checked the output of
sparse with and without this change. The change correctly causes sparse
to throw an error.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
include/linux/rcupdate.h