Fix-Point commented on code in PR #18224:
URL: https://github.com/apache/nuttx/pull/18224#discussion_r2739428795


##########
sched/wdog/wdog.h:
##########
@@ -110,13 +155,20 @@ static inline_function clock_t 
wd_adjust_next_tick(clock_t tick)
 
   return next_tick;
 }
+#  else
+#    define wd_adjust_next_tick(tick) (tick)
+#  endif
 
-static inline_function void wd_timer_start(clock_t tick)
+static inline_function void wd_timer_start(clock_t tick, bool in_expiration)
 {
   clock_t next_tick = wd_adjust_next_tick(tick);
-
 #ifdef CONFIG_HRTIMER
-  nxsched_hrtimer_tick_start(tick);
+  DEBUGASSERT(next_tick <= CLOCK_MAX / NSEC_PER_SEC);
+  if (!in_expiration)
+    {
+      hrtimer_start(&g_wdog_hrtimer, wd_timer,
+                    TICK2NSEC((uint64_t)next_tick), HRTIMER_MODE_ABS);

Review Comment:
   `TICK2NSEC(tick)` will expand to `((tick) * NSEC_PER_TICK)`, where the type 
of `NSEC_PER_TICK` is `long`. We should ensure the `(tick)` is 64-bit to avoid 
multiplication overflow.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to