From: arozansk@redhat.com
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac@vger.kernel.org, Aristeu Rozanski <arozansk@redhat.com>
Subject: [PATCH 3/3] rasdaemon: ras-memory-failure-handler: handle localtime() failure correctly
Date: Wed, 20 Jul 2022 10:40:00 -0400 [thread overview]
Message-ID: <20220720143957.977427150@redhat.com> (raw)
In-Reply-To: 20220720143957.795358633@redhat.com
We could just have an empty string but keeping the format could prevent
issues if someone is actually parsing this.
Found with covscan.
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, "0000-00-00 00:00:00 GMT", sizeof(ev.timestamp));
trace_seq_printf(s, "%s ", ev.timestamp);
if (pevent_get_field_val(s, event, "pfn", record, &val, 1) < 0)
next prev parent reply other threads:[~2022-07-20 14: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 ` arozansk [this message]
2022-07-20 15:33 ` [PATCH 3/3] rasdaemon: ras-memory-failure-handler: handle localtime() failure correctly Elliott, Robert (Servers)
2022-07-20 15:39 ` 'arozansk@redhat.com'
2022-07-20 15:40 ` [PATCH 3/3 v2] " arozansk
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=20220720143957.977427150@redhat.com \
--to=arozansk@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.