[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2180832.bWdqFupBK3@wuerfel>
Date: Fri, 15 Jul 2016 13:35:52 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Kees Cook <keescook@...omium.org>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH] lkdtm: hide unused functions
A conversion of the lkdtm core module added an "#ifdef CONFIG_KPROBES" check,
but a number of functions then become unused:
drivers/misc/lkdtm_core.c:340:16: error: 'lkdtm_debugfs_entry' defined but not used [-Werror=unused-function]
drivers/misc/lkdtm_core.c:122:12: error: 'jp_generic_ide_ioctl' defined but not used [-Werror=unused-function]
drivers/misc/lkdtm_core.c:114:12: error: 'jp_scsi_dispatch_cmd' defined but not used [-Werror=unused-function]
drivers/misc/lkdtm_core.c:106:12: error: 'jp_hrtimer_start' defined but not used [-Werror=unused-function]
drivers/misc/lkdtm_core.c:97:22: error: 'jp_shrink_inactive_list' defined but not used [-Werror=unused-function]
drivers/misc/lkdtm_core.c:89:13: error: 'jp_ll_rw_block' defined but not used [-Werror=unused-function]
drivers/misc/lkdtm_core.c:83:13: error: 'jp_tasklet_action' defined but not used [-Werror=unused-function]
drivers/misc/lkdtm_core.c:75:20: error: 'jp_handle_irq_event' defined but not used [-Werror=unused-function]
drivers/misc/lkdtm_core.c:68:21: error: 'jp_do_irq' defined but not used [-Werror=unused-function]
This adds the same #ifdef everywhere. There is probably a better way to do the
same thing, but for now this avoids the new warnings.
Signed-off-by: Arnd Bergmann <arnd@...db.de>
Fixes: c479e3fd8870 ("lkdtm: use struct arrays instead of enums")
---
On Wednesday, July 6, 2016 3:33:31 PM CEST Kees Cook wrote:
> +
> +/* Define the possible places where we can trigger a crash point. */
> +struct crashpoint crashpoints[] = {
> + CRASHPOINT("DIRECT", direct_entry,
> + NULL, NULL),
> +#ifdef CONFIG_KPROBES
> + CRASHPOINT("INT_HARDWARE_ENTRY", lkdtm_debugfs_entry,
> + "do_IRQ", jp_do_irq),
> + CRASHPOINT("INT_HW_IRQ_EN", lkdtm_debugfs_entry,
> + "handle_IRQ_event", jp_handle_irq_event),
> + CRASHPOINT("INT_TASKLET_ENTRY", lkdtm_debugfs_entry,
diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c
index de29a339242a..6bdef16f95a2 100644
--- a/drivers/misc/lkdtm_core.c
+++ b/drivers/misc/lkdtm_core.c
@@ -53,12 +53,14 @@
#define DEFAULT_COUNT 10
-static void lkdtm_handler(void);
static int lkdtm_debugfs_open(struct inode *inode, struct file *file);
static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf,
size_t count, loff_t *off);
static ssize_t direct_entry(struct file *f, const char __user *user_buf,
size_t count, loff_t *off);
+
+#ifdef CONFIG_KPROBES
+static void lkdtm_handler(void);
static ssize_t lkdtm_debugfs_entry(struct file *f,
const char __user *user_buf,
size_t count, loff_t *off);
@@ -128,7 +130,7 @@ static int jp_generic_ide_ioctl(ide_drive_t *drive, struct file *file,
return 0;
}
#endif
-
+#endif
/* Crash points */
struct crashpoint {
@@ -240,7 +242,9 @@ struct crashtype *lkdtm_crashtype;
/* Global crash counter and spinlock. */
static int crash_count = DEFAULT_COUNT;
+#ifdef CONFIG_KPROBES
static DEFINE_SPINLOCK(crash_count_lock);
+#endif
/* Module parameters */
static int recur_count = -1;
@@ -285,6 +289,7 @@ static noinline void lkdtm_do_action(struct crashtype *crashtype)
crashtype->func();
}
+#ifdef CONFIG_KPROBES
/* Called by jprobe entry points. */
static void lkdtm_handler(void)
{
@@ -307,6 +312,7 @@ static void lkdtm_handler(void)
if (do_it)
lkdtm_do_action(lkdtm_crashtype);
}
+#endif
static int lkdtm_register_cpoint(struct crashpoint *crashpoint,
struct crashtype *crashtype)
@@ -337,6 +343,7 @@ static int lkdtm_register_cpoint(struct crashpoint *crashpoint,
return ret;
}
+#ifdef CONFIG_KPROBES
static ssize_t lkdtm_debugfs_entry(struct file *f,
const char __user *user_buf,
size_t count, loff_t *off)
@@ -374,6 +381,7 @@ static ssize_t lkdtm_debugfs_entry(struct file *f,
return count;
}
+#endif
/* Generic read callback that just prints out the available crash types */
static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf,
Powered by blists - more mailing lists