[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1543056613-4779-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp>
Date: Sat, 24 Nov 2018 19:50:13 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Subject: [PATCH] printk: don't unconditionally shortcut print_time()
Since /sys/module/printk/parameters/time can change from N to Y between
"msg_print_text() called print_prefix() with buf == NULL" and
"msg_print_text() again calls print_prefix() with buf != NULL", it is not
safe for print_time() to unconditionally return 0 if printk_time == false.
Signed-off-by: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
---
kernel/printk/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 5c2079d..df7ced0 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1230,7 +1230,7 @@ static size_t print_time(u64 ts, char *buf)
{
unsigned long rem_nsec;
- if (!printk_time)
+ if (!printk_time && buf)
return 0;
rem_nsec = do_div(ts, 1000000000);
--
1.8.3.1
Powered by blists - more mailing lists