|
|
b7b5ae |
commit ce33041e0abfa20054ff5d6874ffbd1ab592558d
|
|
|
b7b5ae |
Author: Aristeu Rozanski <arozansk@redhat.com>
|
|
|
b7b5ae |
Date: Thu Jan 19 08:45:57 2023 -0500
|
|
|
b7b5ae |
|
|
|
b7b5ae |
rasdaemon: ras-memory-failure-handler: handle localtime() failure correctly
|
|
|
b7b5ae |
|
|
|
b7b5ae |
We could just have an empty string but keeping the format could prevent
|
|
|
b7b5ae |
issues if someone is actually parsing this.
|
|
|
b7b5ae |
Found with covscan.
|
|
|
b7b5ae |
|
|
|
b7b5ae |
v2: fixed the timestamp as pointed by Robert Elliott
|
|
|
b7b5ae |
|
|
|
b7b5ae |
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
|
|
|
b7b5ae |
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
|
|
|
b7b5ae |
|
|
|
b7b5ae |
diff --git a/ras-memory-failure-handler.c b/ras-memory-failure-handler.c
|
|
|
b7b5ae |
index 9941e68..1951456 100644
|
|
|
b7b5ae |
--- a/ras-memory-failure-handler.c
|
|
|
b7b5ae |
+++ b/ras-memory-failure-handler.c
|
|
|
b7b5ae |
@@ -148,6 +148,8 @@ int ras_memory_failure_event_handler(struct trace_seq *s,
|
|
|
b7b5ae |
if (tm)
|
|
|
b7b5ae |
strftime(ev.timestamp, sizeof(ev.timestamp),
|
|
|
b7b5ae |
"%Y-%m-%d %H:%M:%S %z", tm);
|
|
|
b7b5ae |
+ else
|
|
|
b7b5ae |
+ strncpy(ev.timestamp, "1970-01-01 00:00:00 +0000", sizeof(ev.timestamp));
|
|
|
b7b5ae |
trace_seq_printf(s, "%s ", ev.timestamp);
|
|
|
b7b5ae |
|
|
|
b7b5ae |
if (pevent_get_field_val(s, event, "pfn", record, &val, 1) < 0)
|