diff --git a/arch/arm/src/common/arm_checkstack.c b/arch/arm/src/common/arm_checkstack.c index 80d1c323ab2..e32994d6354 100644 --- a/arch/arm/src/common/arm_checkstack.c +++ b/arch/arm/src/common/arm_checkstack.c @@ -172,7 +172,7 @@ void arm_stack_color(void *stackbase, size_t nbytes) } stkend = STACK_ALIGN_DOWN(stkend); - nwords = (stkend - (uintptr_t)stackbase) >> 2; + nwords = (stkend - (uintptr_t)stkptr) >> 2; /* Set the entire stack to the coloration value */ diff --git a/arch/ceva/src/common/ceva_createstack.c b/arch/ceva/src/common/ceva_createstack.c index ed7738df0b6..64c2eb134eb 100644 --- a/arch/ceva/src/common/ceva_createstack.c +++ b/arch/ceva/src/common/ceva_createstack.c @@ -253,7 +253,7 @@ void ceva_stack_color(void *stackbase, size_t nbytes) } stkend = STACK_ALIGN_DOWN(stkend); - nwords = (stkend - (uintptr_t)stackbase) >> 2; + nwords = (stkend - (uintptr_t)stkptr) >> 2; /* Set the entire stack to the coloration value */ diff --git a/arch/or1k/src/common/or1k_createstack.c b/arch/or1k/src/common/or1k_createstack.c index e4e36d211bb..87725f493b0 100644 --- a/arch/or1k/src/common/or1k_createstack.c +++ b/arch/or1k/src/common/or1k_createstack.c @@ -226,7 +226,7 @@ void or1k_stack_color(void *stackbase, size_t nbytes) } stkend = STACK_ALIGN_DOWN(stkend); - nwords = (stkend - (uintptr_t)stackbase) >> 2; + nwords = (stkend - (uintptr_t)stkptr) >> 2; /* Set the entire stack to the coloration value */ diff --git a/arch/risc-v/src/common/riscv_createstack.c b/arch/risc-v/src/common/riscv_createstack.c index c15e1b0e811..122710fb607 100644 --- a/arch/risc-v/src/common/riscv_createstack.c +++ b/arch/risc-v/src/common/riscv_createstack.c @@ -236,7 +236,7 @@ void riscv_stack_color(void *stackbase, size_t nbytes) } stkend = STACK_ALIGN_DOWN(stkend); - nwords = (stkend - (uintptr_t)stackbase) >> 2; + nwords = (stkend - (uintptr_t)stkptr) >> 2; /* Set the entire stack to the coloration value */ diff --git a/arch/sim/src/sim/sim_createstack.c b/arch/sim/src/sim/sim_createstack.c index fc7557b3827..fe91dd7e257 100644 --- a/arch/sim/src/sim/sim_createstack.c +++ b/arch/sim/src/sim/sim_createstack.c @@ -188,7 +188,7 @@ void nostackprotect_function sim_stack_color(void *stackbase, } stkend = STACK_ALIGN_DOWN(stkend); - nwords = (stkend - (uintptr_t)stackbase) >> 2; + nwords = (stkend - (uintptr_t)stkptr) >> 2; nwords = nwords > STACK_MARGIN_WORDS ? nwords - STACK_MARGIN_WORDS : 0; /* Set the entire stack to the coloration value */ diff --git a/arch/sparc/src/common/sparc_checkstack.c b/arch/sparc/src/common/sparc_checkstack.c index b56653d79f3..1a710984344 100644 --- a/arch/sparc/src/common/sparc_checkstack.c +++ b/arch/sparc/src/common/sparc_checkstack.c @@ -172,7 +172,7 @@ void sparc_stack_color(void *stackbase, size_t nbytes) } stkend = STACK_ALIGN_DOWN(stkend); - nwords = (stkend - (uintptr_t)stackbase) >> 2; + nwords = (stkend - (uintptr_t)stkptr) >> 2; /* Set the entire stack to the coloration value */ diff --git a/arch/xtensa/src/common/xtensa_createstack.c b/arch/xtensa/src/common/xtensa_createstack.c index d8a972ee08b..24b24eb1976 100644 --- a/arch/xtensa/src/common/xtensa_createstack.c +++ b/arch/xtensa/src/common/xtensa_createstack.c @@ -242,7 +242,7 @@ void xtensa_stack_color(void *stackbase, size_t nbytes) } stkend = STACK_ALIGN_DOWN(stkend); - nwords = (stkend - (uintptr_t)stackbase) >> 2; + nwords = (stkend - (uintptr_t)stkptr) >> 2; /* Set the entire stack to the coloration value */