Commit 088a52aa authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

printk: only look for prefix levels in kernel messages

vprintk_emit() prefix parsing should only be done for internal kernel
messages.  This allows existing behavior to be kept in all cases.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Kay Sievers <kay@vrfy.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 04d2c8c8
...@@ -1487,7 +1487,6 @@ asmlinkage int vprintk_emit(int facility, int level, ...@@ -1487,7 +1487,6 @@ asmlinkage int vprintk_emit(int facility, int level,
size_t text_len; size_t text_len;
enum log_flags lflags = 0; enum log_flags lflags = 0;
unsigned long flags; unsigned long flags;
int kern_level;
int this_cpu; int this_cpu;
int printed_len = 0; int printed_len = 0;
...@@ -1543,21 +1542,24 @@ asmlinkage int vprintk_emit(int facility, int level, ...@@ -1543,21 +1542,24 @@ asmlinkage int vprintk_emit(int facility, int level,
lflags |= LOG_NEWLINE; lflags |= LOG_NEWLINE;
} }
/* strip syslog prefix and extract log level or control flags */ /* strip kernel syslog prefix and extract log level or control flags */
kern_level = printk_get_level(text); if (facility == 0) {
if (kern_level) { int kern_level = printk_get_level(text);
const char *end_of_header = printk_skip_level(text);
switch (kern_level) { if (kern_level) {
case '0' ... '7': const char *end_of_header = printk_skip_level(text);
if (level == -1) switch (kern_level) {
level = kern_level - '0'; case '0' ... '7':
case 'd': /* KERN_DEFAULT */ if (level == -1)
lflags |= LOG_PREFIX; level = kern_level - '0';
case 'c': /* KERN_CONT */ case 'd': /* KERN_DEFAULT */
break; lflags |= LOG_PREFIX;
case 'c': /* KERN_CONT */
break;
}
text_len -= end_of_header - text;
text = (char *)end_of_header;
} }
text_len -= end_of_header - text;
text = (char *)end_of_header;
} }
if (level == -1) if (level == -1)
......
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