[rtems commit] sptests/spcbssched02: PR2081: Workaround

Sebastian Huber sebh at rtems.org
Wed Nov 21 15:36:30 UTC 2012


Module:    rtems
Branch:    master
Commit:    c1e350ca90f862d332d25863ea9e7c2ed05837c9
Changeset: http://git.rtems.org/rtems/commit/?id=c1e350ca90f862d332d25863ea9e7c2ed05837c9

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Nov 21 10:59:32 2012 +0100

sptests/spcbssched02: PR2081: Workaround

Avoid uninitialized stack variable.  This is not a proper fix.  It is
not clear what the task should do if argument != 1.

---

 testsuites/sptests/spcbssched02/task_periodic.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/testsuites/sptests/spcbssched02/task_periodic.c b/testsuites/sptests/spcbssched02/task_periodic.c
index a3a6edf..defaa00 100644
--- a/testsuites/sptests/spcbssched02/task_periodic.c
+++ b/testsuites/sptests/spcbssched02/task_periodic.c
@@ -30,7 +30,7 @@ rtems_task Task_Periodic(
 
   int start, stop, now;
 
-  rtems_cbs_server_id server_id, tsid;
+  rtems_cbs_server_id server_id = 0, tsid;
   rtems_cbs_parameters params, tparams;
 
   params.deadline = Period;
@@ -115,13 +115,15 @@ rtems_task Task_Periodic(
       rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now );
       if ( now >= start + Execution ) break;
 
-      if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
-        printf( "ERROR: GET EXECUTION TIME FAILED\n" );
-      if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget) )
-        printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
-      if ( (remaining_budget + exec_time) > (Execution + 1) ) {
-        printf( "ERROR: REMAINING BUDGET AND EXECUTION TIME MISMATCH\n" );
-        rtems_test_exit( 0 );
+      if ( server_id != 0 ) {
+        if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
+          printf( "ERROR: GET EXECUTION TIME FAILED\n" );
+        if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget) )
+          printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
+        if ( (remaining_budget + exec_time) > (Execution + 1) ) {
+          printf( "ERROR: REMAINING BUDGET AND EXECUTION TIME MISMATCH\n" );
+          rtems_test_exit( 0 );
+        }
       }
     }
     rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop );




More information about the vc mailing list