PD#SWPL-4900
Problem:
printk_prefix() passes NULL buf to print_time() to get the length of
the time prefix; when printk times are enable, the current code just
return "snprint(NULL, 0, "[%5lu.000000]", (unsigned long)ts)"
but in the SMP case, we add cpu core id at the end of time prefix, the
format is "[%5lu, %06lu@%d]", this gives a wrong size(shorter).
this will make buf get out of boundary, when run dmesg.
Solution:
replace [%5lu.000000] with [%5lu.000000@0]
Verify:
g12a-u200
Change-Id: Ic74b9f466b5af5aac7e6569a1afc7a46d9594050
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
rem_nsec = do_div(ts, 1000000000);
if (!buf)
+#ifdef CONFIG_AMLOGIC_MODIFY
+ return snprintf(NULL, 0, "[%5lu.000000@0] ", (unsigned long)ts);
+#else
return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts);
+#endif
#if defined(CONFIG_SMP) && defined(CONFIG_AMLOGIC_DRIVER)
return sprintf(buf, "[%5lu.%06lu@%d] ",