Skip to contentSkip to conversation

generic BUG: printk "cut here" headers at appropriate levels

PATCH New Paul Collins 1 participant 1 message Feb 9, 2009 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic BUG: printk "cut here" headers at appropriate levels

Many machines, mine included, are configured to route syslog messages at level "emerg" to all terminals. It seems kind of silly to emit the least meaningful part of a BUG-style report at the highest possible priority.

---
 lib/bug.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
lib/bug.c +2 -2
index 300e41a..c35f4d8 100644
@@ -136,8 +136,6 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
 
 	bug = find_bug(bugaddr);
 
-	printk(KERN_EMERG "------------[ cut here ]------------\n");
-
 	file = NULL;
 	line = 0;
 	warning = 0;
@@ -156,6 +154,7 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
 
 	if (warning) {
 		/* this is a WARN_ON rather than BUG/BUG_ON */
+		printk(KERN_ERR "------------[ cut here ]------------\n");
 		if (file)
 			printk(KERN_ERR "Badness at %s:%u\n",
 			       file, line);
@@ -169,6 +168,7 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
 		return BUG_TRAP_TYPE_WARN;
 	}
 
+	printk(KERN_CRIT "------------[ cut here ]------------\n");
 	if (file)
 		printk(KERN_CRIT "kernel BUG at %s:%u!\n",
 		       file, line);
Signature · 4 lines
Paul Collins
Wellington, New Zealand

Dag vijandelijk luchtschip de huismeester is dood