All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@am.sony.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] printk-times bugfix for loglevel-only printks
Date: Thu, 10 Mar 2005 09:26:41 -0800	[thread overview]
Message-ID: <42308351.4090606@am.sony.com> (raw)

Linus,

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.

Please apply. Thanks.
 -- Tim Bird, Senior Software Engineer, Sony Electronics

diffstat:
 printk.c |    5 +++++
 1 files changed, 5 insertions(+)

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Acked-by: Tony Luck <tony.luck@intel.com>
--------------------------------------
diff -pruN printk-1/kernel/printk.c printk-fix1/kernel/printk.c
--- printk-1/kernel/printk.c	2005-03-09 15:42:04.550944124 -0800
+++ printk-fix1/kernel/printk.c	2005-03-09 15:36:18.928567360 -0800
@@ -579,6 +579,7 @@ asmlinkage int vprintk(const char *fmt,
 				   p[1] <= '7' && p[2] == '>') {
 					loglev_char = p[1];
 					p += 3;
+					printed_len += 3;
 				} else {
 					loglev_char = default_message_loglevel
 						+ '0';
@@ -593,6 +594,7 @@ asmlinkage int vprintk(const char *fmt,

 				for (tp = tbuf; tp < tbuf + tlen; tp++)
 					emit_log_char (*tp);
+				printed_len += tlen - 3;
 			} else {
 				if (p[0] != '<' || p[1] < '0' ||
 				   p[1] > '7' || p[2] != '>') {
@@ -601,8 +603,11 @@ asmlinkage int vprintk(const char *fmt,
 						+ '0');
 					emit_log_char('>');
 				}
+				printed_len += 3;
 			}
 			log_level_unknown = 0;
+			if (!*p)
+				break;
 		}
 		emit_log_char(*p);
 		if (*p == '\n')

                 reply	other threads:[~2005-03-10 17:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42308351.4090606@am.sony.com \
    --to=tim.bird@am.sony.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.