From 98d2d2feda519573c07319ef5615ffb42db5e4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20J=C3=A4ger?= Date: Mon, 15 Nov 2021 14:44:32 +0100 Subject: [PATCH] task_wdt: fix overflow in current_ticks making wdt get stuck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The task_wdt was getting stuck after approx. 36 hours on e.g. nRF52840, which has a SysTick with 32768 Hz. This corresponds to an overflow of the uint32_t current_ticks in schedule_next_timeout. This commit fixes the accidentally introduced narrowing conversion. Fixes #40152 Signed-off-by: Martin Jäger --- subsys/task_wdt/task_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/task_wdt/task_wdt.c b/subsys/task_wdt/task_wdt.c index a3a9b87d85c..6693a6287bd 100644 --- a/subsys/task_wdt/task_wdt.c +++ b/subsys/task_wdt/task_wdt.c @@ -50,7 +50,7 @@ static int hw_wdt_channel; static bool hw_wdt_started; #endif -static void schedule_next_timeout(uint32_t current_ticks) +static void schedule_next_timeout(int64_t current_ticks) { int next_channel_id; /* channel which will time out next */ int64_t next_timeout; /* timeout in absolute ticks of this channel */