Merge remote-tracking branch 'stable/linux-3.0.y' into develop-3.0
author黄涛 <huangtao@rock-chips.com>
Sat, 23 Feb 2013 08:41:10 +0000 (16:41 +0800)
committer黄涛 <huangtao@rock-chips.com>
Sat, 23 Feb 2013 08:41:10 +0000 (16:41 +0800)
Merge v3.0.66
Conflicts:
Makefile

include/linux/syslog.h
kernel/printk.c

index 38911391a139a37376e2053008d6e7bb49559cd5..ce4c6655605937c62d7048d6ee0b7130d47d703c 100644 (file)
 #define SYSLOG_FROM_CALL 0
 #define SYSLOG_FROM_FILE 1
 
+/*
+ * Syslog priority (PRI) maximum length in char : '<[0-9]{1,3}>'
+ * See RFC5424 for details
+*/
+#define SYSLOG_PRI_MAX_LENGTH 5
+
 int do_syslog(int type, char __user *buf, int count, bool from_file);
 
 #endif /* _LINUX_SYSLOG_H */
index aa0f9f7850b27840ebbe67cd38eb6f932047f8e9..02f1ec6b34f342152267d58fb98d7764295d41a9 100644 (file)
@@ -684,8 +684,19 @@ static void call_console_drivers(unsigned start, unsigned end)
        start_print = start;
        while (cur_index != end) {
                if (msg_level < 0 && ((end - cur_index) > 2)) {
+                       /*
+                        * prepare buf_prefix, as a contiguous array,
+                        * to be processed by log_prefix function
+                        */
+                       char buf_prefix[SYSLOG_PRI_MAX_LENGTH+1];
+                       unsigned i;
+                       for (i = 0; i < ((end - cur_index)) && (i < SYSLOG_PRI_MAX_LENGTH); i++) {
+                               buf_prefix[i] = LOG_BUF(cur_index + i);
+                       }
+                       buf_prefix[i] = '\0'; /* force '\0' as last string character */
+
                        /* strip log prefix */
-                       cur_index += log_prefix(&LOG_BUF(cur_index), &msg_level, NULL);
+                       cur_index += log_prefix((const char *)&buf_prefix, &msg_level, NULL);
                        start_print = cur_index;
                }
                while (cur_index != end) {