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 49c202c74e38daff80535556690e3f9df38a945c
Author: hujun5 <[email protected]>
AuthorDate: Wed Jan 7 18:36:38 2026 +0800

    sched/signal: assert the dispatch arguments before first use
    
    The DEBUGASSERT() in nxsig_tcbdispatch() validates stcb and info, but
    sits after the sinfo() trace that dereferences both.  With signal trace
    enabled, a NULL argument faults inside sinfo() before the assert can
    report it.  Move the check ahead of the first use.
    
    Signed-off-by: hujun5 <[email protected]>
    Signed-off-by: zhangyuan29 <[email protected]>
---
 sched/signal/sig_dispatch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c
index 409c5e134ad..81e32e74909 100644
--- a/sched/signal/sig_dispatch.c
+++ b/sched/signal/sig_dispatch.c
@@ -603,13 +603,13 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, FAR 
siginfo_t *info,
 #endif
   bool ignored = false;
 
+  DEBUGASSERT(stcb != NULL && info != NULL);
+
   sinfo("TCB=%p pid=%d signo=%d code=%d value=%d masked=%s\n",
         stcb, stcb->pid, info->si_signo, info->si_code,
         info->si_value.sival_int,
         sigismember(&stcb->sigprocmask, info->si_signo) == 1 ? "YES" : "NO");
 
-  DEBUGASSERT(stcb != NULL && info != NULL);
-
   /* Return ESRCH when thread was in exit processing */
 
   if ((stcb->flags & TCB_FLAG_EXIT_PROCESSING) != 0)

Reply via email to