[PATCH] Fix bytecount result from printk()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

--- 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)
--- 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)

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux