From: arozansk@redhat.com
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac@vger.kernel.org, "Elliott,
Robert (Servers)" <elliott@hpe.com>
Subject: [PATCH 3/3 v2] rasdaemon: ras-memory-failure-handler: handle localtime() failure correctly
Date: Wed, 20 Jul 2022 11:40:33 -0400 [thread overview]
Message-ID: <20220720154033.6kup6lark2ddwlrr@redhat.com> (raw)
In-Reply-To: <MW5PR84MB1842E4A18E672F6E13896D0CAB8E9@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM>
We could just have an empty string but keeping the format could prevent
issues if someone is actually parsing this.
Found with covscan.
v2: fixed the timestamp as pointed by Robert Elliott
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
diff --git a/ras-memory-failure-handler.c b/ras-memory-failure-handler.c
index 9941e68..9574141 100644
--- a/ras-memory-failure-handler.c
+++ b/ras-memory-failure-handler.c
@@ -148,6 +148,8 @@ int ras_memory_failure_event_handler(struct trace_seq *s,
if (tm)
strftime(ev.timestamp, sizeof(ev.timestamp),
"%Y-%m-%d %H:%M:%S %z", tm);
+ else
+ strncpy(ev.timestamp, "1970-01-01 00:00:00 +0000", sizeof(ev.timestamp));
trace_seq_printf(s, "%s ", ev.timestamp);
if (pevent_get_field_val(s, event, "pfn", record, &val, 1) < 0)
prev parent reply other threads:[~2022-07-20 15:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 14:39 [PATCH 0/3] rasdaemon: misc fixes arozansk
2022-07-20 14:39 ` [PATCH 1/3] rasdaemon: ras-report: fix possible but unlikely file descriptor leak arozansk
2022-07-20 14:39 ` [PATCH 2/3] rasdaemon: mce-amd-smca: properly limit bank types arozansk
2022-07-20 14:40 ` [PATCH 3/3] rasdaemon: ras-memory-failure-handler: handle localtime() failure correctly arozansk
2022-07-20 15:33 ` Elliott, Robert (Servers)
2022-07-20 15:39 ` 'arozansk@redhat.com'
2022-07-20 15:40 ` arozansk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220720154033.6kup6lark2ddwlrr@redhat.com \
--to=arozansk@redhat.com \
--cc=elliott@hpe.com \
--cc=linux-edac@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox