diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-07-01 12:02:24 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-07-01 12:03:12 +0200 |
commit | 88525944f367101759aea0f2c9e3940bd3fb876f (patch) | |
tree | 6d683a27b5d3ea6ebc8a1f9fcf0690b2c88c7507 | |
parent | bsps/sparc: Reduce copy and paste (diff) | |
download | rtems-88525944f367101759aea0f2c9e3940bd3fb876f.tar.bz2 |
sptests/spcontext01: Avoid NULL pointer access
-rw-r--r-- | testsuites/sptests/spcontext01/init.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/testsuites/sptests/spcontext01/init.c b/testsuites/sptests/spcontext01/init.c index e1af302c7a..49a54d08f6 100644 --- a/testsuites/sptests/spcontext01/init.c +++ b/testsuites/sptests/spcontext01/init.c @@ -163,6 +163,12 @@ static void test(test_context *self) static void test_context_is_executing(void) { #if defined(RTEMS_SMP) + /* + * Provide a stack area, since on some architectures the top/bottom of stack + * is initialized by _CPU_Context_Initialize(). + */ + static char stack[1024]; + Context_Control context; bool is_executing; @@ -180,7 +186,15 @@ static void test_context_is_executing(void) rtems_test_assert(!is_executing); _CPU_Context_Set_is_executing(&context, true); - _CPU_Context_Initialize(&context, NULL, 0, 0, NULL, false, NULL); + _CPU_Context_Initialize( + &context, + &stack[0], + sizeof(stack), + 0, + NULL, + false, + NULL + ); is_executing = _CPU_Context_Get_is_executing(&context); rtems_test_assert(is_executing); #endif |