[PATCH] lib/bug: Fix build error
From: Julien Thierry
Date: Fri Nov 03 2017 - 09:48:16 EST
Generic bug management code handle a table of bugs per module. When kernel
is built without CONFIG_MODULES, the module_bug_list is compiled out, yet
generic_bug_clear_once tries to reference it, causing an error.
Introduce helper function to avoid the reference to module_bug_list when it
is not defined.
Signed-off-by: Julien Thierry <julien.thierry@xxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
lib/bug.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/lib/bug.c b/lib/bug.c
index fa9c901..54c1a9b 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -50,6 +50,8 @@
extern struct bug_entry __start___bug_table[], __stop___bug_table[];
+static void clear_once_table(struct bug_entry *start, struct bug_entry *end);
+
static inline unsigned long bug_addr(const struct bug_entry *bug)
{
#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
@@ -121,8 +123,23 @@ void module_bug_cleanup(struct module *mod)
list_del_rcu(&mod->bug_list);
}
+static void module_bug_clear_once(void)
+{
+ struct module *mod;
+
+ rcu_read_lock_sched();
+ list_for_each_entry_rcu(mod, &module_bug_list, bug_list)
+ clear_once_table(mod->bug_table,
+ mod->bug_table + mod->num_bugs);
+ rcu_read_unlock_sched();
+}
+
#else
+static inline void module_bug_clear_once(void)
+{
+}
+
static inline struct bug_entry *module_find_bug(unsigned long bugaddr)
{
return NULL;
@@ -207,13 +224,6 @@ static void clear_once_table(struct bug_entry *start, struct bug_entry *end)
void generic_bug_clear_once(void)
{
- struct module *mod;
-
- rcu_read_lock_sched();
- list_for_each_entry_rcu(mod, &module_bug_list, bug_list)
- clear_once_table(mod->bug_table,
- mod->bug_table + mod->num_bugs);
- rcu_read_unlock_sched();
-
+ module_bug_clear_once();
clear_once_table(__start___bug_table, __stop___bug_table);
}
--
1.9.1