Skip to content

Commit

Permalink
printk: only look for prefix levels in kernel messages
Browse files Browse the repository at this point in the history
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: Joe Perches <[email protected]>
Cc: Kay Sievers <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Jul 31, 2012
1 parent 04d2c8c commit 088a52a
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions kernel/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,6 @@ asmlinkage int vprintk_emit(int facility, int level,
size_t text_len;
enum log_flags lflags = 0;
unsigned long flags;
int kern_level;
int this_cpu;
int printed_len = 0;

Expand Down Expand Up @@ -1543,21 +1542,24 @@ asmlinkage int vprintk_emit(int facility, int level,
lflags |= LOG_NEWLINE;
}

/* strip syslog prefix and extract log level or control flags */
kern_level = printk_get_level(text);
if (kern_level) {
const char *end_of_header = printk_skip_level(text);
switch (kern_level) {
case '0' ... '7':
if (level == -1)
level = kern_level - '0';
case 'd': /* KERN_DEFAULT */
lflags |= LOG_PREFIX;
case 'c': /* KERN_CONT */
break;
/* strip kernel syslog prefix and extract log level or control flags */
if (facility == 0) {
int kern_level = printk_get_level(text);

if (kern_level) {
const char *end_of_header = printk_skip_level(text);
switch (kern_level) {
case '0' ... '7':
if (level == -1)
level = kern_level - '0';
case 'd': /* KERN_DEFAULT */
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)
Expand Down

0 comments on commit 088a52a

Please sign in to comment.