From 4d7e86eeb6627fabc9595ead52155ab3fbc4a866 Mon Sep 17 00:00:00 2001 From: xiaqilin Date: Wed, 21 Feb 2024 15:09:36 +0800 Subject: [PATCH] fix(openthread): fix openthread alarm timer calculation remaining_us overflow issue --- components/openthread/src/port/esp_openthread_alarm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/openthread/src/port/esp_openthread_alarm.c b/components/openthread/src/port/esp_openthread_alarm.c index f1e4a52d12..ce19e71dc8 100644 --- a/components/openthread/src/port/esp_openthread_alarm.c +++ b/components/openthread/src/port/esp_openthread_alarm.c @@ -101,8 +101,8 @@ void esp_openthread_alarm_deinit(void) void esp_openthread_alarm_update(esp_openthread_mainloop_context_t *mainloop) { struct timeval *timeout = &mainloop->timeout; - int32_t remain_min_time_us = INT32_MAX; - int32_t remaining_us = 0; + int64_t remain_min_time_us = INT64_MAX; + int64_t remaining_us = 0; if (s_is_ms_running) { remaining_us = calculate_duration(s_alarm_ms, otPlatAlarmMilliGetNow()) * US_PER_MS; if (remain_min_time_us > remaining_us) {