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 05fb38dea2cfed80bfa07f9ddc6523d06fabfc54
Author: zhangyu117 <[email protected]>
AuthorDate: Thu May 7 21:57:17 2026 +0800

    arch/tricore: return 0 in up_getusrsp when regs is NULL
    
    The fast irq path (like CONFIG_ARCH_HIPRI_INTERRUPT) does not save
    regs in irq, similar to arm's pendsv, so xcp.regs may be NULL.
    TriCore cannot access the NULL address, so check regs before use.
    
    Signed-off-by: zhangyu117 <[email protected]>
---
 arch/tricore/include/irq.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/tricore/include/irq.h b/arch/tricore/include/irq.h
index 65fac5f8360..8883fbc60c2 100644
--- a/arch/tricore/include/irq.h
+++ b/arch/tricore/include/irq.h
@@ -420,6 +420,11 @@ static inline_function uintptr_t up_getusrsp(void *regs)
 {
   uintptr_t *csaregs = (uintptr_t *)regs;
 
+  if (csaregs == NULL)
+    {
+      return 0;
+    }
+
   if (csaregs[REG_LPCXI] & PCXI_UL)
     {
       csaregs = tricore_csa2addr(csaregs[REG_LPCXI]);

Reply via email to