From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Joel Stanley" <joel@jms.id.au>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>
Subject: Re: [PATCH for-8.2 1/4] hw/rtc/m48t59: Use 64-bit arithmetic in set_alarm()
Date: Fri, 21 Jul 2023 10:42:23 +0100 [thread overview]
Message-ID: <CAFEAcA8cAqVmRdGriOXykozNtzSO09tO3YN8hdFGXgqcuQcU1w@mail.gmail.com> (raw)
In-Reply-To: <af35fc94-f8de-7c7f-6ae1-b84bbe550afb@linaro.org>
On Fri, 21 Jul 2023 at 10:09, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 20/7/23 17:58, Peter Maydell wrote:
> > In the m48t59 device we almost always use 64-bit arithmetic when
> > dealing with time_t deltas. The one exception is in set_alarm(),
> > which currently uses a plain 'int' to hold the difference between two
> > time_t values. Switch to int64_t instead to avoid any possible
> > overflow issues.
> >
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> > hw/rtc/m48t59.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Similarly:
>
> -- >8 --
> --- a/hw/rtc/m48t59.c
> +++ b/hw/rtc/m48t59.c
> @@ -88,7 +88,7 @@ static M48txxInfo m48txx_sysbus_info[] = {
> static void alarm_cb (void *opaque)
> {
> struct tm tm;
> - uint64_t next_time;
> + int64_t next_time;
> M48t59State *NVRAM = opaque;
Why? next_time should always be positive here, I think.
-- PMM
next prev parent reply other threads:[~2023-07-21 9:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 15:58 [PATCH for-8.2 0/4] rtc devices: Avoid putting time_t in 32-bit variables Peter Maydell
2023-07-20 15:58 ` [PATCH for-8.2 1/4] hw/rtc/m48t59: Use 64-bit arithmetic in set_alarm() Peter Maydell
2023-07-21 9:03 ` Philippe Mathieu-Daudé
2023-07-21 9:09 ` Philippe Mathieu-Daudé
2023-07-21 9:42 ` Peter Maydell [this message]
2023-07-20 15:59 ` [PATCH for-8.2 2/4] hw/rtc/twl92230: Use int64_t for sec_offset and alm_sec Peter Maydell
2023-07-21 9:09 ` Philippe Mathieu-Daudé
2023-07-20 15:59 ` [PATCH for-8.2 3/4] hw/rtc/aspeed_rtc: Use 64-bit offset for holding time_t difference Peter Maydell
2023-07-20 16:42 ` Cédric Le Goater
2023-07-20 16:45 ` Peter Maydell
2023-07-20 16:58 ` Cédric Le Goater
2023-07-20 15:59 ` [PATCH for-8.2 4/4] rtc: Use time_t for passing and returning time offsets Peter Maydell
2023-07-21 9:18 ` Philippe Mathieu-Daudé
2023-07-21 9:03 ` [PATCH for-8.2 0/4] rtc devices: Avoid putting time_t in 32-bit variables Philippe Mathieu-Daudé
2023-07-21 9:45 ` Peter Maydell
2023-07-24 5:15 ` Markus Armbruster
2023-07-21 9:16 ` Philippe Mathieu-Daudé
2023-07-21 9:46 ` Peter Maydell
2023-07-24 14:01 ` Philippe Mathieu-Daudé
2023-08-29 15:50 ` 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=CAFEAcA8cAqVmRdGriOXykozNtzSO09tO3YN8hdFGXgqcuQcU1w@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=hpoussin@reactos.org \
--cc=joel@jms.id.au \
--cc=pbonzini@redhat.com \
--cc=philmd@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).