Messages in this thread Patch in this message | | | From | Tetsuo Handa <> | Subject | [PATCH] printk: don't unconditionally shortcut print_time() | Date | Sat, 24 Nov 2018 19:50:13 +0900 |
| |
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@I-love.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
| |