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

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

commit eab468dcb2b06d9a1ab22fe5c807166140367498
Author: yushuailong <[email protected]>
AuthorDate: Mon Sep 7 00:16:52 2026 +0800

    sched/sched: Fix inverted sporadic parameter validation.
    
    Commit 2ec7d90eba refactored sched_setparam() into set_sporadic_param()
    but moved the apply logic into the former reject branch without
    inverting the condition.  As a result sched_setparam() rejects valid
    sporadic parameters (repl >= 2 * budget) with EINVAL and accepts
    invalid ones, tripping the DEBUGASSERT in sched_sporadic.c or wrapping
    the replenishment calculation.
    
    Invert the condition to match process_sporadic() in sched_setscheduler.c.
    
    Fixes: 2ec7d90eba ("sched_setparam.c: coverity HIS_metric_violation: 
RETURN")
    Assisted-by: OpenAI Codex
    Signed-off-by: yushuailong <[email protected]>
---
 sched/sched/sched_setparam.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sched/sched/sched_setparam.c b/sched/sched/sched_setparam.c
index 11faeb45e10..a302e6e660e 100644
--- a/sched/sched/sched_setparam.c
+++ b/sched/sched/sched_setparam.c
@@ -87,7 +87,7 @@ int set_sporadic_param(FAR const struct sched_param *param,
            * half the duty.
            */
 
-          if (repl_ticks < (2 * budget_ticks))
+          if (repl_ticks >= (2 * budget_ticks))
 #else
           if (repl_ticks < budget_ticks)
 #endif

Reply via email to