diff mbox series

Fix verbose arch/sh panic messages.

Message ID 1da19521-b70c-272c-51bb-9416ece62772@landley.net (mailing list archive)
State New, archived
Headers show
Series Fix verbose arch/sh panic messages. | expand

Commit Message

Rob Landley April 9, 2020, 8:09 a.m. UTC
From: Rob Landley <rob@landley.net>

These days printk() adds a newline, so 8 lines of memory dump becomes 80.

Signed-off-by: Rob Landley <rob@landley.net>
---

 arch/sh/kernel/dumpstack.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Geert Uytterhoeven April 9, 2020, 8:16 a.m. UTC | #1
Hi Rob,

On Thu, Apr 9, 2020 at 10:03 AM Rob Landley <rob@landley.net> wrote:
> From: Rob Landley <rob@landley.net>
>
> These days printk() adds a newline, so 8 lines of memory dump becomes 80.
>
> Signed-off-by: Rob Landley <rob@landley.net>

See also "[PATCH 2/7] sh: dump_stack: Fix broken lines and ptrval in
calltrace dumps" of series "[PATCH 0/7] sh: Modernize printing of kernel
messages"
https://lore.kernel.org/lkml/20191203162645.19950-1-geert+renesas@glider.be/

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
index 9f1c9c11d62d..bfbae0d79dde 100644
--- a/arch/sh/kernel/dumpstack.c
+++ b/arch/sh/kernel/dumpstack.c
@@ -19,12 +19,14 @@ 
 void dump_mem(const char *str, unsigned long bottom, unsigned long top)
 {
 	unsigned long p;
+	char buf[128], *s;
 	int i;

 	printk("%s(0x%08lx to 0x%08lx)\n", str, bottom, top);

 	for (p = bottom & ~31; p < top; ) {
-		printk("%04lx: ", p & 0xffff);
+		s = buf;
+		s += sprintf(s, "%04lx: ", p & 0xffff);

 		for (i = 0; i < 8; i++, p += 4) {
 			unsigned int val;
@@ -33,13 +35,13 @@ 
 				printk("         ");
 			else {
 				if (__get_user(val, (unsigned int __user *)p)) {
-					printk("\n");
+					printk("FAULT\n");
 					return;
 				}
-				printk("%08x ", val);
+				s += sprintf(s, "%08x ", val);
 			}
 		}
-		printk("\n");
+		printk("%s\n", buf);
 	}
 }