[PATCH 4/7] bug: Lift "cut here" out of __warn()

From: Kees Cook
Date: Mon Aug 19 2019 - 19:41:39 EST


In preparation for cleaning up "cut here", move the "cut here" logic
up out of __warn() and into callers that pass non-NULL args. For anyone
looking closely, there are two callers that pass NULL args: one already
explicitly prints "cut here". The remaining case is covered by how a
WARN is built, which will be cleaned up in the next patch.

Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
---
kernel/panic.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 51efdeb2558e..dc2243429903 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -551,9 +551,6 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
{
disable_trace_on_warning();

- if (args)
- pr_warn(CUT_HERE);
-
if (file)
pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n",
raw_smp_processor_id(), current->pid, file, line,
@@ -597,8 +594,9 @@ void warn_slowpath_fmt(const char *file, int line, unsigned taint,
{
struct warn_args args;

+ pr_warn(CUT_HERE);
+
if (!fmt) {
- pr_warn(CUT_HERE);
__warn(file, line, __builtin_return_address(0), taint,
NULL, NULL);
return;
--
2.17.1