Skip to contentSkip to conversation

bug: define the "cut here" string in a single place

PATCH New [email protected] 1 participant 1 message Nov 17, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 20/94 bug: define the "cut here" string in a single place

From: Kees Cook <[email protected]>
Subject: bug: define the "cut here" string in a single place

The "cut here" string is used in a few paths. Define it in a single place.

---

 arch/mn10300/mm/fault.c   |    2 +-
 include/asm-generic/bug.h |    2 ++
 kernel/panic.c            |    2 +-
 lib/bug.c                 |    2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
arch/mn10300/mm/fault.c renamed from arch/mn10300/mm/fault.c~bug-define-the-cut-here-string-in-a-single-place +1 -1
diff -puN arch/mn10300/mm/fault.c~bug-define-the-cut-here-string-in-a-single-place arch/mn10300/mm/fault.c
@@ -60,7 +60,7 @@ void bust_spinlocks(int yes)
 void do_BUG(const char *file, int line)
 {
 	bust_spinlocks(1);
-	printk(KERN_EMERG "------------[ cut here ]------------\n");
+	printk(KERN_EMERG CUT_HERE);
 	printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
 }
 
include/asm-generic/bug.h renamed from include/asm-generic/bug.h~bug-define-the-cut-here-string-in-a-single-place +2 -0
diff -puN include/asm-generic/bug.h~bug-define-the-cut-here-string-in-a-single-place include/asm-generic/bug.h
@@ -4,6 +4,8 @@
 
 #include <linux/compiler.h>
 
+#define CUT_HERE		"------------[ cut here ]------------\n"
+
 #ifdef CONFIG_GENERIC_BUG
 #define BUGFLAG_WARNING		(1 << 0)
 #define BUGFLAG_ONCE		(1 << 1)
kernel/panic.c renamed from kernel/panic.c~bug-define-the-cut-here-string-in-a-single-place +1 -1
diff -puN kernel/panic.c~bug-define-the-cut-here-string-in-a-single-place kernel/panic.c
@@ -520,7 +520,7 @@ void __warn(const char *file, int line,
 {
 	disable_trace_on_warning();
 
-	pr_warn("------------[ cut here ]------------\n");
+	pr_warn(CUT_HERE);
 
 	if (file)
 		pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n",
lib/bug.c renamed from lib/bug.c~bug-define-the-cut-here-string-in-a-single-place +1 -1
diff -puN lib/bug.c~bug-define-the-cut-here-string-in-a-single-place lib/bug.c
@@ -186,7 +186,7 @@ enum bug_trap_type report_bug(unsigned l
 		return BUG_TRAP_TYPE_WARN;
 	}
 
-	printk(KERN_DEFAULT "------------[ cut here ]------------\n");
+	printk(KERN_DEFAULT CUT_HERE);
 
 	if (file)
 		pr_crit("kernel BUG at %s:%u!\n", file, line);

_