public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix bytecount result from printk()
@ 2005-12-01 15:55 Mark Lord
  2005-12-01 16:09 ` Linus Torvalds
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Mark Lord @ 2005-12-01 15:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 1430 bytes --]

printk() returns a bytecount, which nothing actually appears to use.

This count is generated internally in vprintk(),
and is off-by-3 for one particular path through that function.

This patch fixes it to be consistent with how it is calculated
for the other paths through that same function (vprintk).

Whether or not the count should even exist in the first place
is still a question for examination -- nothing appears to use it.

On a related note, WHY does the LOG LEVEL format <6> not get
interpreted correctly for the first printk() after an oops report?
As in this example -- the <6> is printed, instead of being interpreted:

	kernel:  <6>note: insmod[31060] exited with preempt_count 1

Here's the off-by-3 fix patch.

Signed-off-by:  Mark Lord <lkml@rtr.ca>

--- linux-2.6.15-rc3/kernel/printk.c.orig       2005-11-29 23:24:19.000000000 -0500
+++ linux/kernel/printk.c       2005-12-01 10:01:39.000000000 -0500
@@ -592,8 +592,8 @@
                                         emit_log_char(default_message_loglevel
                                                 + '0');
                                         emit_log_char('>');
-                               }
-                               printed_len += 3;
+                               } else
+                                       printed_len += 3;
                         }
                         log_level_unknown = 0;
                         if (!*p)

[-- Attachment #2: printk.patch --]
[-- Type: text/x-patch, Size: 358 bytes --]

--- linux-2.6.15-rc3/kernel/printk.c.orig	2005-11-29 23:24:19.000000000 -0500
+++ linux/kernel/printk.c	2005-12-01 10:01:39.000000000 -0500
@@ -592,8 +592,8 @@
 					emit_log_char(default_message_loglevel
 						+ '0');
 					emit_log_char('>');
-				}
-				printed_len += 3;
+				} else
+					printed_len += 3;
 			}
 			log_level_unknown = 0;
 			if (!*p)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-12-02  2:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-01 15:55 [PATCH] Fix bytecount result from printk() Mark Lord
2005-12-01 16:09 ` Linus Torvalds
2005-12-01 16:25   ` Mark Lord
2005-12-01 17:57 ` Dave Jones
2005-12-01 20:15   ` David S. Miller
2005-12-02  1:23     ` Andi Kleen
2005-12-01 21:09       ` Mark Lord
2005-12-01 21:16         ` Andi Kleen
2005-12-02  2:04   ` Andrew Morton
2005-12-02  2:22     ` Mark Lord
2005-12-01 20:14 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox