From f4ad4dafcc7a693515801962a92ff2e6f1eded12 Mon Sep 17 00:00:00 2001 From: Solar Designer Date: Thu, 19 Sep 2024 18:52:19 +0200 Subject: [PATCH] Fix some clang warnings See #291 Co-authored-by: Alexander Pick --- src/modules/integrity_timer/verify_kprobes/p_verify_kprobes.c | 4 ++++ src/modules/print_log/p_lkrg_print_log.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/modules/integrity_timer/verify_kprobes/p_verify_kprobes.c b/src/modules/integrity_timer/verify_kprobes/p_verify_kprobes.c index 73ddd96c..e65b7bdf 100644 --- a/src/modules/integrity_timer/verify_kprobes/p_verify_kprobes.c +++ b/src/modules/integrity_timer/verify_kprobes/p_verify_kprobes.c @@ -28,7 +28,11 @@ static struct kretprobe p_lkrg_dummy_kretprobe = { .entry_handler = p_lkrg_dummy_entry, }; +#ifdef __clang__ +__attribute__((optnone)) +#else __attribute__((optimize(0))) +#endif noinline int lkrg_dummy(int arg) { p_debug_log(P_LOG_DEBUG, diff --git a/src/modules/print_log/p_lkrg_print_log.h b/src/modules/print_log/p_lkrg_print_log.h index 65039cbf..2b2637ba 100644 --- a/src/modules/print_log/p_lkrg_print_log.h +++ b/src/modules/print_log/p_lkrg_print_log.h @@ -112,6 +112,8 @@ p_print_ret = printk(KERN_CRIT P_LKRG_SIGNATURE "ALERT: " p_fmt "\n", ## p_args); \ else if (P_CTRL(p_log_level) >= (p_level & 7)) \ switch (p_level) { \ + default: /* Pacify clang warning about no case P_LOG_ALERT, which we handle above */ \ + break; \ case P_LOG_ALIVE: \ p_print_ret = printk(KERN_NOTICE P_LKRG_SIGNATURE "ALIVE: " p_fmt "\n", ## p_args); \ break; \