Commit f7859590 authored by Richard Guy Briggs's avatar Richard Guy Briggs Committed by Paul Moore

audit: eliminate audit_enabled magic number comparison

Remove comparison of audit_enabled to magic numbers outside of audit.

Related: https://github.com/linux-audit/audit-kernel/issues/86Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent d904ac03
...@@ -92,7 +92,7 @@ static void tty_audit_buf_push(struct tty_audit_buf *buf) ...@@ -92,7 +92,7 @@ static void tty_audit_buf_push(struct tty_audit_buf *buf)
{ {
if (buf->valid == 0) if (buf->valid == 0)
return; return;
if (audit_enabled == 0) { if (audit_enabled == AUDIT_OFF) {
buf->valid = 0; buf->valid = 0;
return; return;
} }
......
...@@ -117,6 +117,9 @@ struct filename; ...@@ -117,6 +117,9 @@ struct filename;
extern void audit_log_session_info(struct audit_buffer *ab); extern void audit_log_session_info(struct audit_buffer *ab);
#define AUDIT_OFF 0
#define AUDIT_ON 1
#define AUDIT_LOCKED 2
#ifdef CONFIG_AUDIT #ifdef CONFIG_AUDIT
/* These are defined in audit.c */ /* These are defined in audit.c */
/* Public API */ /* Public API */
...@@ -202,7 +205,7 @@ static inline int audit_log_task_context(struct audit_buffer *ab) ...@@ -202,7 +205,7 @@ static inline int audit_log_task_context(struct audit_buffer *ab)
static inline void audit_log_task_info(struct audit_buffer *ab, static inline void audit_log_task_info(struct audit_buffer *ab,
struct task_struct *tsk) struct task_struct *tsk)
{ } { }
#define audit_enabled 0 #define audit_enabled AUDIT_OFF
#endif /* CONFIG_AUDIT */ #endif /* CONFIG_AUDIT */
#ifdef CONFIG_AUDIT_COMPAT_GENERIC #ifdef CONFIG_AUDIT_COMPAT_GENERIC
......
...@@ -735,7 +735,7 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op) ...@@ -735,7 +735,7 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
{ {
struct audit_buffer *audit_buf = NULL; struct audit_buffer *audit_buf = NULL;
if (audit_enabled == 0) if (audit_enabled == AUDIT_OFF)
return NULL; return NULL;
audit_buf = audit_log_start(audit_context(), GFP_ATOMIC, audit_buf = audit_log_start(audit_context(), GFP_ATOMIC,
AUDIT_MAC_IPSEC_EVENT); AUDIT_MAC_IPSEC_EVENT);
......
...@@ -83,9 +83,6 @@ ...@@ -83,9 +83,6 @@
#define AUDIT_INITIALIZED 1 #define AUDIT_INITIALIZED 1
static int audit_initialized; static int audit_initialized;
#define AUDIT_OFF 0
#define AUDIT_ON 1
#define AUDIT_LOCKED 2
u32 audit_enabled = AUDIT_OFF; u32 audit_enabled = AUDIT_OFF;
bool audit_ever_enabled = !!AUDIT_OFF; bool audit_ever_enabled = !!AUDIT_OFF;
......
...@@ -72,7 +72,7 @@ audit_tg(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -72,7 +72,7 @@ audit_tg(struct sk_buff *skb, const struct xt_action_param *par)
struct audit_buffer *ab; struct audit_buffer *ab;
int fam = -1; int fam = -1;
if (audit_enabled == 0) if (audit_enabled == AUDIT_OFF)
goto errout; goto errout;
ab = audit_log_start(NULL, GFP_ATOMIC, AUDIT_NETFILTER_PKT); ab = audit_log_start(NULL, GFP_ATOMIC, AUDIT_NETFILTER_PKT);
if (ab == NULL) if (ab == NULL)
......
...@@ -101,7 +101,7 @@ struct audit_buffer *netlbl_audit_start_common(int type, ...@@ -101,7 +101,7 @@ struct audit_buffer *netlbl_audit_start_common(int type,
char *secctx; char *secctx;
u32 secctx_len; u32 secctx_len;
if (audit_enabled == 0) if (audit_enabled == AUDIT_OFF)
return NULL; return NULL;
audit_buf = audit_log_start(audit_context(), GFP_ATOMIC, type); audit_buf = audit_log_start(audit_context(), GFP_ATOMIC, type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment