[PATCH 2/4] consolesimpletask.c: Fix Coverity Unchecked return value

Ryan Long thisisryanlong at gmail.com
Thu Feb 11 20:27:40 UTC 2021


Fixes CID #1437625 and #1472765 where the return value of rtems_task_create and
rtems_task_start is discarded.
---
 cpukit/libcsupport/src/consolesimpletask.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cpukit/libcsupport/src/consolesimpletask.c b/cpukit/libcsupport/src/consolesimpletask.c
index 82ea2a5..927085b 100644
--- a/cpukit/libcsupport/src/consolesimpletask.c
+++ b/cpukit/libcsupport/src/consolesimpletask.c
@@ -217,6 +217,7 @@ static const char _Console_simple_task_Name[] = "console";
 void _Console_simple_task_Initialize( void )
 {
   Console_simple_task_Control *cons;
+  rtems_status_code status;
 
   cons = &_Console_simple_task_Instance;
 
@@ -233,7 +234,7 @@ void _Console_simple_task_Initialize( void )
 
   IMFS_add_node( "/dev", &cons->Node, NULL );
 
-  rtems_task_create(
+  status = rtems_task_create(
     rtems_build_name('C', 'O', 'N', 'S'),
     RTEMS_MAXIMUM_PRIORITY - 1,
     RTEMS_MINIMUM_STACK_SIZE,
@@ -241,10 +242,12 @@ void _Console_simple_task_Initialize( void )
     RTEMS_DEFAULT_MODES,
     &cons->task
   );
+  _Assert_Unused_return_value_equal(status, RTEMS_SUCCESSFUL);
 
-  rtems_task_start(
+  status = rtems_task_start(
     cons->task,
     _Console_simple_task_Task,
     (rtems_task_argument) cons
   );
+  _Assert_Unused_return_value_equal(status, RTEMS_SUCCESSFUL);
 }
-- 
1.8.3.1



More information about the devel mailing list