All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
	"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 0/4] rtc devices: Avoid putting time_t in 32-bit variables
Date: Mon, 24 Jul 2023 07:15:44 +0200	[thread overview]
Message-ID: <87wmypx533.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFEAcA_xWsNOROQqeLcuPX2XLOjbwKdEA75WcKn2qdTAHdVBGg@mail.gmail.com> (Peter Maydell's message of "Fri, 21 Jul 2023 10:45:07 +0100")

Peter Maydell <peter.maydell@linaro.org> writes:

> On Fri, 21 Jul 2023 at 10:03, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> +Markus
>>
>> On 20/7/23 17:58, Peter Maydell wrote:
>> > This patchset was prompted by a couple of Coverity warnings
>> > (CID 1507157, 1517772) which note that in the m48t59 RTC device model
>> > we keep an offset in a time_t variable but then truncate it by
>> > passing it to qemu_get_timedate(), which currently uses an 'int'
>> > argument for its offset parameter.
>> >
>> > We can fix the Coverity complaint by making qemu_get_timedate()
>> > take a time_t; we should also correspondingly make the
>> > qemu_timedate_diff() function return a time_t. However this
>> > will only push the issue out to callers of qemu_timedate_diff()
>> > if they are putting the result in a 32-bit variable or doing
>> > 32-bit arithmetic on it.
>> >
>> > Luckily there aren't that many callers of qemu_timedate_diff()
>> > and most of them already use either time_t or int64_t for the
>> > calculations they do on its return value. The first three
>> > patches fix devices which weren't doing that; patch four then
>> > fixes the rtc.c functions. If I missed any callsites in devices
>> > then hopefully Coverity will point them out.
>>
>> Do we need to change the type of the RTC_CHANGE event?

[...]

> If I understand the 'Built-in Types' section in
> docs/devel/qapi-code-gen.rst correctly, the QAPI 'int'
> type is already 64 bits.

Correct.  Also needlessly confusing.



  reply	other threads:[~2023-07-24  5:16 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
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 [this message]
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=87wmypx533.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=hpoussin@reactos.org \
    --cc=joel@jms.id.au \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 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.