The patch titled Subject: kernel/panic: return early from print_tainted() when not tainted has been added to the -mm mm-nonmm-unstable branch. Its filename is kernel-panic-return-early-from-print_tainted-when-not-tainted.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kernel-panic-return-early-from-print_tainted-when-not-tainted.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Jani Nikula <jani.nikula@xxxxxxxxx> Subject: kernel/panic: return early from print_tainted() when not tainted Date: Fri, 31 May 2024 12:04:54 +0300 Reduce indent to make follow-up changes slightly easier on the eyes. Link: https://lkml.kernel.org/r/01d6c03de1c9d1b52b59c652a3704a0a9886ed63.1717146197.git.jani.nikula@xxxxxxxxx Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> Cc: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/panic.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) --- a/kernel/panic.c~kernel-panic-return-early-from-print_tainted-when-not-tainted +++ a/kernel/panic.c @@ -507,22 +507,23 @@ const struct taint_flag taint_flags[TAIN const char *print_tainted(void) { static char buf[TAINT_FLAGS_COUNT + sizeof("Tainted: ")]; + char *s; + int i; BUILD_BUG_ON(ARRAY_SIZE(taint_flags) != TAINT_FLAGS_COUNT); - if (tainted_mask) { - char *s; - int i; - - 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; - } else + if (!tainted_mask) { snprintf(buf, sizeof(buf), "Not tainted"); + return 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; return buf; } _ Patches currently in -mm which might be from jani.nikula@xxxxxxxxx are kernel-panic-return-early-from-print_tainted-when-not-tainted.patch kernel-panic-convert-print_tainted-to-use-struct-seq_buf-internally.patch kernel-panic-initialize-taint_flags-using-a-macro.patch kernel-panic-add-verbose-logging-of-kernel-taints-in-backtraces.patch