
If early stack usage is exactly same as SIZE_LIMIT_PROVIDE_STACK, then its most likely to have overflowed beyond this limit and corrupted any regions beyond stack. Warn about this to the user.
Signed-off-by: Vignesh Raghavendra vigneshr@ti.com ---
I found this useful when debugging slient corruption of code/data leading to random failures post relocation.
common/spl/spl.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/common/spl/spl.c b/common/spl/spl.c index 72078a8ebc8e..9a9c8fad7673 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -950,6 +950,13 @@ __weak void spl_relocate_stack_check(void) } printf("SPL initial stack usage: %lu bytes\n", CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK) - i); + + /* + * If we used up all of the SIZE_LIMIT_PROVIDE_STACK, then here is high + * possibility of stack overflow, warn the user accordingly + */ + if (!i) + printf("SPL possible initial stack overflow detected!!\n"); #endif }