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

xiaoxiang pushed a commit to branch releases/12.5
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/releases/12.5 by this push:
     new 95c5426a18 SMP: Fix returning uninitialized variable in 
nxsched_add_readytorun()
95c5426a18 is described below

commit 95c5426a1872d027e6f4c1babeb3242ce13eeb5c
Author: Mingjie Shen <[email protected]>
AuthorDate: Mon Apr 1 20:36:37 2024 -0400

    SMP: Fix returning uninitialized variable in nxsched_add_readytorun()
    
    Prior to this commit, doswitch is returned uninitialized if
    (task_state == TSTATE_TASK_ASSIGNED || task_state == TSTATE_TASK_RUNNING)
    && no context switch occurs
    && (cpu == me).
    
    Signed-off-by: Mingjie Shen <[email protected]>
---
 sched/sched/sched_addreadytorun.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sched/sched/sched_addreadytorun.c 
b/sched/sched/sched_addreadytorun.c
index 46c0ef9d4d..eb0957c92a 100644
--- a/sched/sched/sched_addreadytorun.c
+++ b/sched/sched/sched_addreadytorun.c
@@ -366,6 +366,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
 
           btcb->cpu        = cpu;
           btcb->task_state = TSTATE_TASK_ASSIGNED;
+          doswitch         = false;
         }
 
       /* All done, restart the other CPU (if it was paused). */

Reply via email to