* [merged mm-nonmm-stable] kernel-panic-convert-print_tainted-to-use-struct-seq_buf-internally.patch removed from -mm tree
@ 2024-06-25 5:26 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-06-25 5:26 UTC (permalink / raw)
To: mm-commits, gregkh, jani.nikula, akpm
The quilt patch titled
Subject: kernel/panic: convert print_tainted() to use struct seq_buf internally
has been removed from the -mm tree. Its filename was
kernel-panic-convert-print_tainted-to-use-struct-seq_buf-internally.patch
This patch was dropped because it was merged into the mm-nonmm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Jani Nikula <jani.nikula@intel.com>
Subject: kernel/panic: convert print_tainted() to use struct seq_buf internally
Date: Fri, 31 May 2024 12:04:55 +0300
Convert print_tainted() to use struct seq_buf internally in order to be
more aware of the buffer constraints as well as make it easier to extend
in follow-up work.
Link: https://lkml.kernel.org/r/cb6006fa7c0f82a6b6885e8eea2920fcdc4fc9d0.1717146197.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/panic.c | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
--- a/kernel/panic.c~kernel-panic-convert-print_tainted-to-use-struct-seq_buf-internally
+++ a/kernel/panic.c
@@ -35,6 +35,7 @@
#include <linux/debugfs.h>
#include <linux/sysfs.h>
#include <linux/context_tracking.h>
+#include <linux/seq_buf.h>
#include <trace/events/error_report.h>
#include <asm/sections.h>
@@ -496,6 +497,25 @@ const struct taint_flag taint_flags[TAIN
[ TAINT_TEST ] = { 'N', ' ', true },
};
+static void print_tainted_seq(struct seq_buf *s)
+{
+ int i;
+
+ if (!tainted_mask) {
+ seq_buf_puts(s, "Not tainted");
+ return;
+ }
+
+ seq_buf_printf(s, "Tainted: ");
+ for (i = 0; i < TAINT_FLAGS_COUNT; i++) {
+ const struct taint_flag *t = &taint_flags[i];
+ bool is_set = test_bit(i, &tainted_mask);
+ char c = is_set ? t->c_true : t->c_false;
+
+ seq_buf_putc(s, c);
+ }
+}
+
/**
* print_tainted - return a string to represent the kernel taint state.
*
@@ -507,25 +527,15 @@ const struct taint_flag taint_flags[TAIN
const char *print_tainted(void)
{
static char buf[TAINT_FLAGS_COUNT + sizeof("Tainted: ")];
- char *s;
- int i;
+ struct seq_buf s;
BUILD_BUG_ON(ARRAY_SIZE(taint_flags) != TAINT_FLAGS_COUNT);
- if (!tainted_mask) {
- snprintf(buf, sizeof(buf), "Not tainted");
- return buf;
- }
+ seq_buf_init(&s, buf, sizeof(buf));
- s = buf + sprintf(buf, "Tainted: ");
- for (i = 0; i < TAINT_FLAGS_COUNT; i++) {
- const struct taint_flag *t = &taint_flags[i];
- *s++ = test_bit(i, &tainted_mask) ?
- t->c_true : t->c_false;
- }
- *s = 0;
+ print_tainted_seq(&s);
- return buf;
+ return seq_buf_str(&s);
}
int test_taint(unsigned flag)
_
Patches currently in -mm which might be from jani.nikula@intel.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-25 5:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 5:26 [merged mm-nonmm-stable] kernel-panic-convert-print_tainted-to-use-struct-seq_buf-internally.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.