bug: lift "cut here" out of __warn()
authorKees Cook <keescook@chromium.org>
Wed, 25 Sep 2019 23:48:01 +0000 (16:48 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Sep 2019 00:51:40 +0000 (17:51 -0700)
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.

Link: http://lkml.kernel.org/r/20190819234111.9019-5-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Drew Davenport <ddavenport@chromium.org>
Cc: Feng Tang <feng.tang@intel.com>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/panic.c

index 79c153951b59b666b2aa22373c55f1aa545e9486..a643e5464296648e6e7122076c7a5f2a2e88bba9 100644 (file)
@@ -559,9 +559,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,
@@ -605,8 +602,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;