• J
    rcu: Add sparse check to rcu_assign_pointer() · 423a86a6
    Joel Fernandes (Google) 提交于
    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: NJoel Fernandes (Google) <joel@joelfernandes.org>
    Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
    423a86a6
rcupdate.h 33.0 KB