[rtems commit] smptests: Avoid use of uninitialized data

Sebastian Huber sebh at rtems.org
Fri Jun 13 14:00:22 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jun 13 16:06:20 2014 +0200

smptests: Avoid use of uninitialized data

---

 testsuites/smptests/smpaffinity01/init.c    |    2 ++
 testsuites/smptests/smppsxaffinity02/init.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/testsuites/smptests/smpaffinity01/init.c b/testsuites/smptests/smpaffinity01/init.c
index 06d5719..969a332 100644
--- a/testsuites/smptests/smpaffinity01/init.c
+++ b/testsuites/smptests/smpaffinity01/init.c
@@ -53,6 +53,7 @@ void Validate_setaffinity_errors(void)
   rtems_test_assert( sc == RTEMS_INVALID_NUMBER );
 
   /* Verify rtems_task_set_affinity checks that at thread id is valid */
+  CPU_ZERO(&cpuset);
   CPU_SET(0, &cpuset);
   puts( "Init - rtems_task_set_affinity - Invalid thread - RTEMS_INVALID_ID" );
   sc = rtems_task_set_affinity( 999, sizeof(cpu_set_t), &cpuset );
@@ -75,6 +76,7 @@ void Validate_getaffinity_errors(void)
   cpu_set_t           cpuset;
 
   /* Verify rtems_task_get_affinity checks that at thread id is valid */
+  CPU_ZERO(&cpuset);
   CPU_SET(0, &cpuset);
   puts( "Init - rtems_task_get_affinity - Invalid thread - RTEMS_INVALID_ID" );
   sc = rtems_task_get_affinity( 999, sizeof(cpu_set_t), &cpuset );
diff --git a/testsuites/smptests/smppsxaffinity02/init.c b/testsuites/smptests/smppsxaffinity02/init.c
index ad98da4..9f2190f 100644
--- a/testsuites/smptests/smppsxaffinity02/init.c
+++ b/testsuites/smptests/smppsxaffinity02/init.c
@@ -58,6 +58,7 @@ void Validate_setaffinity_errors(void)
   rtems_test_assert( sc == EINVAL );
 
   /* Verify pthread_setaffinity_np checks that at thread id is valid */
+  CPU_ZERO(&cpuset);
   CPU_SET(0, &cpuset);
   puts( "Init - pthread_setaffinity_np - Invalid thread - ESRCH" );
   sc = pthread_setaffinity_np( 999, sizeof(cpu_set_t), &cpuset );
@@ -80,6 +81,7 @@ void Validate_getaffinity_errors(void)
   cpu_set_t           cpuset;
 
   /* Verify pthread_getaffinity_np checks that at thread id is valid */
+  CPU_ZERO(&cpuset);
   CPU_SET(0, &cpuset);
   puts( "Init - pthread_getaffinity_np - Invalid thread - ESRCH" );
   sc = pthread_getaffinity_np( 999, sizeof(cpu_set_t), &cpuset );



More information about the vc mailing list