diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-30 16:22:04 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-01 18:05:58 +0200 |
commit | 71689a0775f39d65b3c9f0a81b58394d0b04e534 (patch) | |
tree | cea54dcebe2947cdd41bb98a9c4841915a4b44a8 /cpukit/rtems/src | |
parent | tests: Add and use <rtems/testopts.h> (diff) | |
download | rtems-71689a0775f39d65b3c9f0a81b58394d0b04e534.tar.bz2 |
rtems: Canonicalize name and id checks
Check the name followed by the id check in all create directives.
Compare pointers against NULL. Fix formatting.
Diffstat (limited to 'cpukit/rtems/src')
-rw-r--r-- | cpukit/rtems/src/msgqconstruct.c | 8 | ||||
-rw-r--r-- | cpukit/rtems/src/partcreate.c | 9 | ||||
-rw-r--r-- | cpukit/rtems/src/regioncreate.c | 9 | ||||
-rw-r--r-- | cpukit/rtems/src/taskconstruct.c | 10 |
4 files changed, 22 insertions, 14 deletions
diff --git a/cpukit/rtems/src/msgqconstruct.c b/cpukit/rtems/src/msgqconstruct.c index 61d0472e7c..82f6d2dfad 100644 --- a/cpukit/rtems/src/msgqconstruct.c +++ b/cpukit/rtems/src/msgqconstruct.c @@ -63,14 +63,14 @@ rtems_status_code _Message_queue_Create( bool is_global; #endif - if ( id == NULL ) { - return RTEMS_INVALID_ADDRESS; - } - if ( !rtems_is_name_valid( config->name ) ) { return RTEMS_INVALID_NAME; } + if ( id == NULL ) { + return RTEMS_INVALID_ADDRESS; + } + if ( config->maximum_pending_messages == 0 ) { return RTEMS_INVALID_NUMBER; } diff --git a/cpukit/rtems/src/partcreate.c b/cpukit/rtems/src/partcreate.c index 9aa5e80bf1..4f43743f98 100644 --- a/cpukit/rtems/src/partcreate.c +++ b/cpukit/rtems/src/partcreate.c @@ -38,14 +38,17 @@ rtems_status_code rtems_partition_create( { Partition_Control *the_partition; - if ( !rtems_is_name_valid( name ) ) + if ( !rtems_is_name_valid( name ) ) { return RTEMS_INVALID_NAME; + } - if ( !starting_address ) + if ( id == NULL ) { return RTEMS_INVALID_ADDRESS; + } - if ( !id ) + if ( starting_address == NULL ) { return RTEMS_INVALID_ADDRESS; + } if ( length == 0 ) return RTEMS_INVALID_SIZE; diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index de8f165fe7..99752193ce 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -38,14 +38,17 @@ rtems_status_code rtems_region_create( rtems_status_code return_status; Region_Control *the_region; - if ( !rtems_is_name_valid( name ) ) + if ( !rtems_is_name_valid( name ) ) { return RTEMS_INVALID_NAME; + } - if ( !starting_address ) + if ( id == NULL ) { return RTEMS_INVALID_ADDRESS; + } - if ( !id ) + if ( starting_address == NULL ) { return RTEMS_INVALID_ADDRESS; + } the_region = _Region_Allocate(); diff --git a/cpukit/rtems/src/taskconstruct.c b/cpukit/rtems/src/taskconstruct.c index 76ef8ce5d6..9b1fdec3ae 100644 --- a/cpukit/rtems/src/taskconstruct.c +++ b/cpukit/rtems/src/taskconstruct.c @@ -96,11 +96,13 @@ rtems_status_code _RTEMS_tasks_Create( RTEMS_API_Control *api; ASR_Information *asr; - if ( !id ) - return RTEMS_INVALID_ADDRESS; - - if ( !rtems_is_name_valid( config->name ) ) + if ( !rtems_is_name_valid( config->name ) ) { return RTEMS_INVALID_NAME; + } + + if ( id == NULL ) { + return RTEMS_INVALID_ADDRESS; + } /* * Core Thread Initialize insures we get the minimum amount of |