From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH] system/rtc: Silent overflow in qemu_timedate_diff()
Date: Mon, 1 Sep 2025 13:43:06 +0200 [thread overview]
Message-ID: <182ab8f4-c1c3-4228-b715-c8b0344c5a93@linaro.org> (raw)
In-Reply-To: <20250811100823.94105-1-philmd@linaro.org>
ping?
On 11/8/25 12:08, Philippe Mathieu-Daudé wrote:
> Per ctime(3) man-page:
>
> A negative value for tm_isdst causes the mktime() function to
> attempt to divine whether summer time is in effect for the
> specified time. The tm_isdst and tm_gmtoff members are forced
> to zero by timegm().
>
> The mktime() function returns the specified calendar time; if
> the calendar time cannot be represented, it returns -1;
>
> Coverity reports (CID 1547724 Overflowed return value) the
> qemu_timedate_diff() method doesn't handle this error path.
>
> Since this method was added in commit f650305967f ("Unify RTCs
> that use host time, fix M48t59 alarm") in 2008, and there is no
> open issue related to it, keep ignoring this unlikely case, but
> add an assertion to make Coverity happy.
>
> Fixes: CID 1547724
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> system/rtc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/system/rtc.c b/system/rtc.c
> index 56951288c40..070b99fe6ad 100644
> --- a/system/rtc.c
> +++ b/system/rtc.c
> @@ -98,6 +98,7 @@ time_t qemu_timedate_diff(struct tm *tm)
> struct tm tmp = *tm;
> tmp.tm_isdst = -1; /* use timezone to figure it out */
> seconds = mktime(&tmp);
> + assert(seconds >= 0);
> break;
> }
> default:
next prev parent reply other threads:[~2025-09-01 11:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 10:08 [PATCH] system/rtc: Silent overflow in qemu_timedate_diff() Philippe Mathieu-Daudé
2025-09-01 11:43 ` Philippe Mathieu-Daudé [this message]
2025-09-01 12:08 ` Peter Maydell
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=182ab8f4-c1c3-4228-b715-c8b0344c5a93@linaro.org \
--to=philmd@linaro.org \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).