Blame SOURCES/ce33041e0abfa20054ff5d6874ffbd1ab592558d.patch

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