summaryrefslogtreecommitdiff
path: root/kernel/panic.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/panic.c')
-rw-r--r--kernel/panic.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/kernel/panic.c b/kernel/panic.c
index 21975497bfa4..f861bedc1925 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -475,6 +475,7 @@ EXPORT_SYMBOL(panic);
[ TAINT_##taint ] = { \
.c_true = _c_true, .c_false = _c_false, \
.module = _module, \
+ .desc = #taint, \
}
/*
@@ -505,8 +506,9 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = {
#undef TAINT_FLAG
-static void print_tainted_seq(struct seq_buf *s)
+static void print_tainted_seq(struct seq_buf *s, bool verbose)
{
+ const char *sep = "";
int i;
if (!tainted_mask) {
@@ -520,10 +522,32 @@ static void print_tainted_seq(struct seq_buf *s)
bool is_set = test_bit(i, &tainted_mask);
char c = is_set ? t->c_true : t->c_false;
- seq_buf_putc(s, c);
+ if (verbose) {
+ if (is_set) {
+ seq_buf_printf(s, "%s[%c]=%s", sep, c, t->desc);
+ sep = ", ";
+ }
+ } else {
+ seq_buf_putc(s, c);
+ }
}
}
+static const char *_print_tainted(bool verbose)
+{
+ /* FIXME: what should the size be? */
+ static char buf[sizeof(taint_flags)];
+ struct seq_buf s;
+
+ BUILD_BUG_ON(ARRAY_SIZE(taint_flags) != TAINT_FLAGS_COUNT);
+
+ seq_buf_init(&s, buf, sizeof(buf));
+
+ print_tainted_seq(&s, verbose);
+
+ return seq_buf_str(&s);
+}
+
/**
* print_tainted - return a string to represent the kernel taint state.
*
@@ -534,16 +558,15 @@ static void print_tainted_seq(struct seq_buf *s)
*/
const char *print_tainted(void)
{
- static char buf[TAINT_FLAGS_COUNT + sizeof("Tainted: ")];
- struct seq_buf s;
-
- BUILD_BUG_ON(ARRAY_SIZE(taint_flags) != TAINT_FLAGS_COUNT);
-
- seq_buf_init(&s, buf, sizeof(buf));
-
- print_tainted_seq(&s);
+ return _print_tainted(false);
+}
- return seq_buf_str(&s);
+/**
+ * print_tainted_verbose - A more verbose version of print_tainted()
+ */
+const char *print_tainted_verbose(void)
+{
+ return _print_tainted(true);
}
int test_taint(unsigned flag)