OSDN Git Service

printk: fix discarding message when recursion_bug
authorHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Fri, 19 Dec 2008 18:23:03 +0000 (10:23 -0800)
committerIngo Molnar <mingo@elte.hu>
Fri, 19 Dec 2008 21:52:47 +0000 (22:52 +0100)
Impact: fix truncated recursion bug message printout

When recursion_bug is true, kernel discards original message because printk_buf
contains recursion_bug_msg with NULL terminator. The sizeof(recursion_bug_msg)
makes this, use strlen() to get correct length without NULL terminator.

Reported-by: Toshikazu Nakayama <nakayama.ts@ncos.nec.co.jp>
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/printk.c

index f492f15..e651ab0 100644 (file)
@@ -662,7 +662,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
        if (recursion_bug) {
                recursion_bug = 0;
                strcpy(printk_buf, recursion_bug_msg);
-               printed_len = sizeof(recursion_bug_msg);
+               printed_len = strlen(recursion_bug_msg);
        }
        /* Emit the output into the temporary buffer */
        printed_len += vscnprintf(printk_buf + printed_len,