From: "'arozansk@redhat.com'" <arozansk@redhat.com>
To: "Elliott, Robert (Servers)" <elliott@hpe.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
Subject: Re: [PATCH 3/3] rasdaemon: ras-memory-failure-handler: handle localtime() failure correctly
Date: Wed, 20 Jul 2022 11:39:01 -0400 [thread overview]
Message-ID: <20220720153901.ylxednn2d44h7r3t@redhat.com> (raw)
In-Reply-To: <MW5PR84MB1842E4A18E672F6E13896D0CAB8E9@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM>
On Wed, Jul 20, 2022 at 03:33:49PM +0000, Elliott, Robert (Servers) wrote:
> > -----Original Message-----
> > From: arozansk@redhat.com <arozansk@redhat.com>
> > Sent: Wednesday, July 20, 2022 9:40 AM
> ...
> > Subject: [PATCH 3/3] rasdaemon: ras-memory-failure-handler: handle
> > localtime() failure correctly
> >
> > We could just have an empty string but keeping the format could prevent
> > issues if someone is actually parsing this.
> > Found with covscan.
> >
> ...
> > diff --git 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));
>
>
> Per man strftime:
> %z The +hhmm or -hhmm numeric timezone (that is, the hour and minute offset from UTC). (SU)
> %Z The timezone name or abbreviation.
>
> GMT does not match the lowercase %z format of +hhmm or -hhmm
Good catch, thanks
> Returning the UNIX epoch might be safer, too:
> 1970-01-01 00:00:00 +0000
Agreed, v2 will follow
--
Aristeu
next prev parent reply other threads:[~2022-07-20 15:39 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' [this message]
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=20220720153901.ylxednn2d44h7r3t@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