[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/24] hw/rtc/m48t59: Use 64-bit arithmetic in set_alarm()
From: |
Peter Maydell |
Subject: |
[PULL 18/24] hw/rtc/m48t59: Use 64-bit arithmetic in set_alarm() |
Date: |
Thu, 31 Aug 2023 11:45:13 +0100 |
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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/rtc/m48t59.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c
index ec3e56e84fd..2e2c849985c 100644
--- a/hw/rtc/m48t59.c
+++ b/hw/rtc/m48t59.c
@@ -133,7 +133,7 @@ static void alarm_cb (void *opaque)
static void set_alarm(M48t59State *NVRAM)
{
- int diff;
+ int64_t diff;
if (NVRAM->alrm_timer != NULL) {
timer_del(NVRAM->alrm_timer);
diff = qemu_timedate_diff(&NVRAM->alarm) - NVRAM->time_offset;
--
2.34.1
- [PULL 13/24] Add i.MX6UL missing devices., (continued)
- [PULL 13/24] Add i.MX6UL missing devices., Peter Maydell, 2023/08/31
- [PULL 14/24] Refactor i.MX7 processor code, Peter Maydell, 2023/08/31
- [PULL 08/24] target/arm: Suppress FEAT_TRBE (Trace Buffer Extension), Peter Maydell, 2023/08/31
- [PULL 12/24] Refactor i.MX6UL processor code, Peter Maydell, 2023/08/31
- [PULL 21/24] rtc: Use time_t for passing and returning time offsets, Peter Maydell, 2023/08/31
- [PULL 15/24] Add i.MX7 missing TZ devices and memory regions, Peter Maydell, 2023/08/31
- [PULL 16/24] Add i.MX7 SRC device implementation, Peter Maydell, 2023/08/31
- [PULL 24/24] hw/arm: Set number of MPU regions correctly for an505, an521, an524, Peter Maydell, 2023/08/31
- [PULL 23/24] hw/arm/armv7m: Add mpu-ns-regions and mpu-s-regions properties, Peter Maydell, 2023/08/31
- [PULL 17/24] target/arm: Catch illegal-exception-return from EL3 with bad NSE/NS, Peter Maydell, 2023/08/31
- [PULL 18/24] hw/rtc/m48t59: Use 64-bit arithmetic in set_alarm(),
Peter Maydell <=
- [PULL 20/24] hw/rtc/aspeed_rtc: Use 64-bit offset for holding time_t difference, Peter Maydell, 2023/08/31
- [PULL 22/24] target/arm: Do all "ARM_FEATURE_X implies Y" checks in post_init, Peter Maydell, 2023/08/31
- [PULL 19/24] hw/rtc/twl92230: Use int64_t for sec_offset and alm_sec, Peter Maydell, 2023/08/31
- [PULL 05/24] target/arm: Introduce make_ccsidr64, Peter Maydell, 2023/08/31
- [PULL 11/24] Remove i.MX7 IOMUX GPR device from i.MX6UL, Peter Maydell, 2023/08/31
- Re: [PULL 00/24] target-arm queue, Stefan Hajnoczi, 2023/08/31