Skip to content

Commit cb5172d

Browse files
frextritepcmoore
authored andcommitted
audit: Add __rcu annotation to RCU pointer
Add __rcu annotation to RCU-protected global pointer auditd_conn. auditd_conn is an RCU-protected global pointer,i.e., accessed via RCU methods rcu_dereference() and rcu_assign_pointer(), hence it must be annotated with __rcu for sparse to report warnings/errors correctly. Fix multiple instances of the sparse error: error: incompatible types in comparison expression (different address spaces) Reviewed-by: Joel Fernandes (Google) <[email protected]> Signed-off-by: Amol Grover <[email protected]> [PM: tweak subject line] Signed-off-by: Paul Moore <[email protected]>
1 parent e42617b commit cb5172d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/audit.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ struct audit_net {
102102
* This struct is RCU protected; you must either hold the RCU lock for reading
103103
* or the associated spinlock for writing.
104104
*/
105-
static struct auditd_connection {
105+
struct auditd_connection {
106106
struct pid *pid;
107107
u32 portid;
108108
struct net *net;
109109
struct rcu_head rcu;
110-
} *auditd_conn = NULL;
110+
};
111+
static struct auditd_connection __rcu *auditd_conn;
111112
static DEFINE_SPINLOCK(auditd_conn_lock);
112113

113114
/* If audit_rate_limit is non-zero, limit the rate of sending audit records

0 commit comments

Comments
 (0)