projects/linux·commit e455ca40

audit: avoid missing-prototype warnings

e455ca40 · Arnd Bergmann <[email protected]> · 2023-05-17 15:10:52 +02:00

Building with 'make W=1' reveals two function definitions without
a previous prototype in the audit code:

lib/compat_audit.c:32:5: error: no previous prototype for 'audit_classify_compat_syscall' [-Werror=missing-prototypes]
kernel/audit.c:1813:14: error: no previous prototype for 'audit_serial' [-Werror=missing-prototypes]

The first one needs a declaration from linux/audit.h but cannot
include that header without causing conflicting (compat) syscall number
definitions, so move the it into linux/audit_arch.h.

The second one is declared conditionally based on CONFIG_AUDITSYSCALL
but needed as a local function even when that option is disabled, so
move the declaration out of the #ifdef block.

Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
Commit
e455ca40dbcf2cd50d1e59bf4b2752b300bcdad4
Parents
ac9a7868

Changes

3 files changed · +3 −3

FileStatusAddDelContent
include/linux/audit.hmodified+0−2View file
include/linux/audit_arch.hmodified+2−0View file
kernel/audit.hmodified+1−1View file

include/linux/audit.h

View file
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 31086a7..6a3a9e1 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -130,8 +130,6 @@ extern unsigned compat_dir_class[];
extern unsigned compat_chattr_class[];
extern unsigned compat_signal_class[];
-extern int audit_classify_compat_syscall(int abi, unsigned syscall);
-
/* audit_names->type values */
#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
#define AUDIT_TYPE_NORMAL 1 /* a "normal" audit record */

include/linux/audit_arch.h

View file
diff --git a/include/linux/audit_arch.h b/include/linux/audit_arch.h
index 8fdb1af..0e34d67 100644
--- a/include/linux/audit_arch.h
+++ b/include/linux/audit_arch.h
@@ -21,4 +21,6 @@ enum auditsc_class_t {
AUDITSC_NVALS /* count */
};
+extern int audit_classify_compat_syscall(int abi, unsigned syscall);
+
#endif

kernel/audit.h

View file
diff --git a/kernel/audit.h b/kernel/audit.h
index c57b008..94738bc 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -259,8 +259,8 @@ extern struct tty_struct *audit_get_tty(void);
extern void audit_put_tty(struct tty_struct *tty);
/* audit watch/mark/tree functions */
-#ifdef CONFIG_AUDITSYSCALL
extern unsigned int audit_serial(void);
+#ifdef CONFIG_AUDITSYSCALL
extern int auditsc_get_stamp(struct audit_context *ctx,
struct timespec64 *t, unsigned int *serial);