[rtems commit] sptests/spcontext01: Avoid NULL pointer access
Sebastian Huber
sebh at rtems.org
Tue Jul 1 09:55:23 UTC 2014
Module: rtems
Branch: master
Commit: 88525944f367101759aea0f2c9e3940bd3fb876f
Changeset: http://git.rtems.org/rtems/commit/?id=88525944f367101759aea0f2c9e3940bd3fb876f
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Jul 1 12:02:24 2014 +0200
sptests/spcontext01: Avoid NULL pointer access
---
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 e1af302..49a54d0 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
More information about the vc
mailing list