[rtems commit] rtems: Check entry point in rtems_task_start()
Sebastian Huber
sebh at rtems.org
Fri May 14 07:23:36 UTC 2021
Module: rtems
Branch: master
Commit: b87d2a6364ecc9f11572eac1bb557336b5f3736d
Changeset: http://git.rtems.org/rtems/commit/?id=b87d2a6364ecc9f11572eac1bb557336b5f3736d
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri May 14 09:14:11 2021 +0200
rtems: Check entry point in rtems_task_start()
Close #4410.
---
cpukit/rtems/src/taskstart.c | 4 ++++
testsuites/sptests/sptask_err04/task1.c | 9 +++++++++
2 files changed, 13 insertions(+)
diff --git a/cpukit/rtems/src/taskstart.c b/cpukit/rtems/src/taskstart.c
index eca9b57..57dbfc8 100644
--- a/cpukit/rtems/src/taskstart.c
+++ b/cpukit/rtems/src/taskstart.c
@@ -43,6 +43,10 @@ rtems_status_code rtems_task_start(
ISR_lock_Context lock_context;
Status_Control status;
+ if ( entry_point == NULL ) {
+ return RTEMS_INVALID_ADDRESS;
+ }
+
the_thread = _Thread_Get( id, &lock_context );
if ( the_thread == NULL ) {
diff --git a/testsuites/sptests/sptask_err04/task1.c b/testsuites/sptests/sptask_err04/task1.c
index 29b63db..c1f59d8 100644
--- a/testsuites/sptests/sptask_err04/task1.c
+++ b/testsuites/sptests/sptask_err04/task1.c
@@ -165,6 +165,15 @@ rtems_task Task_1(
);
puts( "TA1 - rtems_task_start - RTEMS_INVALID_ID" );
+ /* NULL entry point */
+ status = rtems_task_start( RTEMS_SELF, NULL, 0 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_task_start with NULL entry point"
+ );
+ puts( "TA1 - rtems_task_start - RTEMS_INVALID_ADDRESS" );
+
/* already started */
status = rtems_task_start( RTEMS_SELF, Task_1, 0 );
fatal_directive_status(
More information about the vc
mailing list