This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit fce40edb6b5031abdebfd5452db7f497a4be189d
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Fri May 16 09:29:35 2025 +0800

    sched/wqueue: Add max delay tick limitation.
    
    This commit added max delay tick limitation for the workqueue.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 include/nuttx/wdog.h       | 1 +
 sched/wqueue/kwork_queue.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/nuttx/wdog.h b/include/nuttx/wdog.h
index 02f18b1b30..7ea0a60278 100644
--- a/include/nuttx/wdog.h
+++ b/include/nuttx/wdog.h
@@ -39,6 +39,7 @@
  ****************************************************************************/
 
 #define WDOG_ISACTIVE(w)   ((w)->func != NULL)
+#define WDOG_MAX_DELAY     ((CLOCK_MAX) / 2 - 1)
 
 /****************************************************************************
  * Public Type Declarations
diff --git a/sched/wqueue/kwork_queue.c b/sched/wqueue/kwork_queue.c
index e91c664b06..ede28bb65c 100644
--- a/sched/wqueue/kwork_queue.c
+++ b/sched/wqueue/kwork_queue.c
@@ -83,7 +83,8 @@ int work_queue_period_wq(FAR struct kwork_wqueue_s *wqueue,
   clock_t expected;
   bool retimer;
 
-  if (wqueue == NULL || work == NULL || worker == NULL)
+  if (wqueue == NULL || work == NULL || worker == NULL ||
+      delay > WDOG_MAX_DELAY)
     {
       return -EINVAL;
     }

Reply via email to