arch: fixed error in the calculation of nwords caused an out of bounds

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2023-03-09 21:03:20 +08:00 committed by Masayuki Ishikawa
parent a581b99266
commit 12bb4f04f1
7 changed files with 7 additions and 7 deletions

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */