Commit f1af5aff authored by Tim Bird's avatar Tim Bird Committed by Linus Torvalds

[PATCH] printk-times bugfix for loglevel-only printks

This patch fixes a bug with the recently added printk-times feature.

In the case where a printk consists of only the log level (followed
subsequently by printks with more text for the same line), the printk-times
code doesn't correctly recognize the end of the string, and starts emitting
chars at the 0 byte at the end of the string.

The patch below fixes this problem.  It also adjusts the handling of
printed_len in the routine, which was affected by the printk-times feature.
Signed-off-by: default avatarTim Bird <tim.bird@am.sony.com>
Acked-by: default avatarTony Luck <tony.luck@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 91105f2f
...@@ -579,6 +579,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) ...@@ -579,6 +579,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
p[1] <= '7' && p[2] == '>') { p[1] <= '7' && p[2] == '>') {
loglev_char = p[1]; loglev_char = p[1];
p += 3; p += 3;
printed_len += 3;
} else { } else {
loglev_char = default_message_loglevel loglev_char = default_message_loglevel
+ '0'; + '0';
...@@ -591,8 +592,9 @@ asmlinkage int vprintk(const char *fmt, va_list args) ...@@ -591,8 +592,9 @@ asmlinkage int vprintk(const char *fmt, va_list args)
(unsigned long)t, (unsigned long)t,
nanosec_rem/1000); nanosec_rem/1000);
for (tp = tbuf; tp< tbuf + tlen; tp++) for (tp = tbuf; tp < tbuf + tlen; tp++)
emit_log_char (*tp); emit_log_char(*tp);
printed_len += tlen - 3;
} else { } else {
if (p[0] != '<' || p[1] < '0' || if (p[0] != '<' || p[1] < '0' ||
p[1] > '7' || p[2] != '>') { p[1] > '7' || p[2] != '>') {
...@@ -601,8 +603,11 @@ asmlinkage int vprintk(const char *fmt, va_list args) ...@@ -601,8 +603,11 @@ asmlinkage int vprintk(const char *fmt, va_list args)
+ '0'); + '0');
emit_log_char('>'); emit_log_char('>');
} }
printed_len += 3;
} }
log_level_unknown = 0; log_level_unknown = 0;
if (!*p)
break;
} }
emit_log_char(*p); emit_log_char(*p);
if (*p == '\n') if (*p == '\n')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment