audit: inline audit_free to simplify the look of generic code
authorEric Paris <eparis@redhat.com>
Tue, 3 Jan 2012 19:23:07 +0000 (14:23 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 17 Jan 2012 21:16:58 +0000 (16:16 -0500)
make the conditional a static inline instead of doing it in generic code.

Signed-off-by: Eric Paris <eparis@redhat.com>
include/linux/audit.h
kernel/auditsc.c
kernel/exit.c

index 4f1efe3e8616960ceaf5c1fcdd0763542407db00..8eb8bda749b39a316f2dad2725cbc30d58b00fd6 100644 (file)
@@ -417,7 +417,7 @@ extern int audit_classify_arch(int arch);
                                /* Public API */
 extern void audit_finish_fork(struct task_struct *child);
 extern int  audit_alloc(struct task_struct *task);
-extern void audit_free(struct task_struct *task);
+extern void __audit_free(struct task_struct *task);
 extern void __audit_syscall_entry(int arch,
                                  int major, unsigned long a0, unsigned long a1,
                                  unsigned long a2, unsigned long a3);
@@ -435,6 +435,11 @@ static inline int audit_dummy_context(void)
        void *p = current->audit_context;
        return !p || *(int *)p;
 }
+static inline void audit_free(struct task_struct *task)
+{
+       if (unlikely(task->audit_context))
+               __audit_free(task);
+}
 static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
                                       unsigned long a1, unsigned long a2,
                                       unsigned long a3)
index e1062f66b01bd2a97e2bd446a806a52e68499ee5..7aaeb38b262abe2dd0e2ed8ab2c87352e2dd07e2 100644 (file)
@@ -1594,7 +1594,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
  *
  * Called from copy_process and do_exit
  */
-void audit_free(struct task_struct *tsk)
+void __audit_free(struct task_struct *tsk)
 {
        struct audit_context *context;
 
index 94ed6e20bb532840e69070f3d623568e17cbe0c1..88dcbbc446f74eb27b952014b33a23736922dccb 100644 (file)
@@ -964,8 +964,7 @@ NORET_TYPE void do_exit(long code)
        acct_collect(code, group_dead);
        if (group_dead)
                tty_audit_exit();
-       if (unlikely(tsk->audit_context))
-               audit_free(tsk);
+       audit_free(tsk);
 
        tsk->exit_code = code;
        taskstats_exit(tsk, group_dead);