2004-05-06 Joel Sherrill <joel@OARcorp.com>

PR 618/rtems
	* include/rtems/rtems/status.h, src/clockget.c, src/clockset.c,
	src/dpmemcreate.c, src/dpmemexternal2internal.c,
	src/dpmeminternal2external.c, src/eventmp.c, src/eventreceive.c,
	src/eventsend.c, src/msgqbroadcast.c, src/msgqcreate.c,
	src/msgqflush.c, src/msgqgetnumberpending.c, src/msgqreceive.c,
	src/msgqsubmit.c, src/partcreate.c, src/partdelete.c,
	src/partgetbuffer.c, src/ratemoncancel.c, src/ratemoncreate.c,
	src/ratemondelete.c, src/ratemongetstatus.c, src/ratemonident.c,
	src/ratemonperiod.c, src/regioncreate.c, src/regiondelete.c,
	src/regionextend.c, src/regiongetsegment.c,
	src/regiongetsegmentsize.c, src/regionreturnsegment.c,
	src/semcreate.c, src/semdelete.c, src/semflush.c, src/semident.c,
	src/taskcreate.c, src/taskgetnote.c, src/taskmode.c,
	src/taskrestart.c, src/taskresume.c, src/tasksetnote.c,
	src/tasksuspend.c, src/taskvariableadd.c, src/taskvariabledelete.c,
	src/taskvariableget.c, src/taskwakewhen.c, src/timercreate.c,
	src/timerdelete.c, src/timerfireafter.c, src/timerfirewhen.c,
	src/timerserverfireafter.c, src/timerserverfirewhen.c: Add NULL
	checks.
This commit is contained in:
Joel Sherrill
2004-05-06 19:20:04 +00:00
parent 424f2e40e9
commit 17bbaddcac
52 changed files with 172 additions and 34 deletions

View File

@@ -1,3 +1,26 @@
2004-05-06 Joel Sherrill <joel@OARcorp.com>
PR 618/rtems
* include/rtems/rtems/status.h, src/clockget.c, src/clockset.c,
src/dpmemcreate.c, src/dpmemexternal2internal.c,
src/dpmeminternal2external.c, src/eventmp.c, src/eventreceive.c,
src/eventsend.c, src/msgqbroadcast.c, src/msgqcreate.c,
src/msgqflush.c, src/msgqgetnumberpending.c, src/msgqreceive.c,
src/msgqsubmit.c, src/partcreate.c, src/partdelete.c,
src/partgetbuffer.c, src/ratemoncancel.c, src/ratemoncreate.c,
src/ratemondelete.c, src/ratemongetstatus.c, src/ratemonident.c,
src/ratemonperiod.c, src/regioncreate.c, src/regiondelete.c,
src/regionextend.c, src/regiongetsegment.c,
src/regiongetsegmentsize.c, src/regionreturnsegment.c,
src/semcreate.c, src/semdelete.c, src/semflush.c, src/semident.c,
src/taskcreate.c, src/taskgetnote.c, src/taskmode.c,
src/taskrestart.c, src/taskresume.c, src/tasksetnote.c,
src/tasksuspend.c, src/taskvariableadd.c, src/taskvariabledelete.c,
src/taskvariableget.c, src/taskwakewhen.c, src/timercreate.c,
src/timerdelete.c, src/timerfireafter.c, src/timerfirewhen.c,
src/timerserverfireafter.c, src/timerserverfirewhen.c: Add NULL
checks.
2004-02-26 Thomas Rauscher <trauscher@loytec.com. 2004-02-26 Thomas Rauscher <trauscher@loytec.com.
PR 584/RTEMS PR 584/RTEMS

View File

@@ -65,6 +65,7 @@ extern rtems_status_code _Status_Object_name_errors_to_status[];
rtems_status_code _Status_Object_name_errors_to_status[] = { rtems_status_code _Status_Object_name_errors_to_status[] = {
RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */ RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */
RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */ RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */
RTEMS_INVALID_ADDRESS, /* OBJECTS_INVALID_ADDRESS */
RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */ RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */
}; };
#endif #endif

View File

@@ -45,6 +45,9 @@ rtems_status_code rtems_clock_get(
ISR_Level level; ISR_Level level;
rtems_interval tmp; rtems_interval tmp;
if ( !time_buffer )
return RTEMS_INVALID_ADDRESS;
switch ( option ) { switch ( option ) {
case RTEMS_CLOCK_GET_TOD: case RTEMS_CLOCK_GET_TOD:
if ( !_TOD_Is_set ) if ( !_TOD_Is_set )

View File

@@ -39,6 +39,9 @@ rtems_status_code rtems_clock_set(
{ {
rtems_interval seconds; rtems_interval seconds;
if ( !time_buffer )
return RTEMS_INVALID_ADDRESS;
if ( _TOD_Validate( time_buffer ) ) { if ( _TOD_Validate( time_buffer ) ) {
seconds = _TOD_To_seconds( time_buffer ); seconds = _TOD_To_seconds( time_buffer );
_Thread_Disable_dispatch(); _Thread_Disable_dispatch();

View File

@@ -52,6 +52,9 @@ rtems_status_code rtems_port_create(
if ( !rtems_is_name_valid( name) ) if ( !rtems_is_name_valid( name) )
return RTEMS_INVALID_NAME; return RTEMS_INVALID_NAME;
if ( !id )
return RTEMS_INVALID_ADDRESS;
if ( !_Addresses_Is_aligned( internal_start ) || if ( !_Addresses_Is_aligned( internal_start ) ||
!_Addresses_Is_aligned( external_start ) ) !_Addresses_Is_aligned( external_start ) )
return RTEMS_INVALID_ADDRESS; return RTEMS_INVALID_ADDRESS;

View File

@@ -49,6 +49,9 @@ rtems_status_code rtems_port_external_to_internal(
Objects_Locations location; Objects_Locations location;
unsigned32 ending; unsigned32 ending;
if ( !internal )
return RTEMS_INVALID_ADDRESS;
the_port = _Dual_ported_memory_Get( id, &location ); the_port = _Dual_ported_memory_Get( id, &location );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: /* this error cannot be returned */ case OBJECTS_REMOTE: /* this error cannot be returned */

View File

@@ -49,6 +49,9 @@ rtems_status_code rtems_port_internal_to_external(
Objects_Locations location; Objects_Locations location;
unsigned32 ending; unsigned32 ending;
if ( !external )
return RTEMS_INVALID_ADDRESS;
the_port = _Dual_ported_memory_Get( id, &location ); the_port = _Dual_ported_memory_Get( id, &location );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: /* this error cannot be returned */ case OBJECTS_REMOTE: /* this error cannot be returned */

View File

@@ -40,7 +40,7 @@
rtems_status_code _Event_MP_Send_request_packet ( rtems_status_code _Event_MP_Send_request_packet (
Event_MP_Remote_operations operation, Event_MP_Remote_operations operation,
Objects_Id event_id, Objects_Id event_id,
rtems_event_set event_in rtems_event_set event_in
) )
{ {
Event_MP_Packet *the_packet; Event_MP_Packet *the_packet;

View File

@@ -48,6 +48,9 @@ rtems_status_code rtems_event_receive(
{ {
RTEMS_API_Control *api; RTEMS_API_Control *api;
if ( !event_out )
return RTEMS_INVALID_ADDRESS;
api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ]; api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
if ( _Event_sets_Is_empty( event_in ) ) { if ( _Event_sets_Is_empty( event_in ) ) {

View File

@@ -37,8 +37,8 @@
*/ */
rtems_status_code rtems_event_send( rtems_status_code rtems_event_send(
Objects_Id id, Objects_Id id,
rtems_event_set event_in rtems_event_set event_in
) )
{ {
register Thread_Control *the_thread; register Thread_Control *the_thread;

View File

@@ -60,6 +60,12 @@ rtems_status_code rtems_message_queue_broadcast(
Objects_Locations location; Objects_Locations location;
CORE_message_queue_Status core_status; CORE_message_queue_Status core_status;
if ( !buffer )
return RTEMS_INVALID_ADDRESS;
if ( !count )
return RTEMS_INVALID_ADDRESS;
the_message_queue = _Message_queue_Get( id, &location ); the_message_queue = _Message_queue_Get( id, &location );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: case OBJECTS_REMOTE:

View File

@@ -67,6 +67,9 @@ rtems_status_code rtems_message_queue_create(
if ( !rtems_is_name_valid( name ) ) if ( !rtems_is_name_valid( name ) )
return RTEMS_INVALID_NAME; return RTEMS_INVALID_NAME;
if ( !id )
return RTEMS_INVALID_ADDRESS;
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
if ( (is_global = _Attributes_Is_global( attribute_set ) ) && if ( (is_global = _Attributes_Is_global( attribute_set ) ) &&
!_System_state_Is_multiprocessing ) !_System_state_Is_multiprocessing )

View File

@@ -56,6 +56,9 @@ rtems_status_code rtems_message_queue_flush(
register Message_queue_Control *the_message_queue; register Message_queue_Control *the_message_queue;
Objects_Locations location; Objects_Locations location;
if ( !count )
return RTEMS_INVALID_ADDRESS;
the_message_queue = _Message_queue_Get( id, &location ); the_message_queue = _Message_queue_Get( id, &location );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: case OBJECTS_REMOTE:

View File

@@ -54,6 +54,9 @@ rtems_status_code rtems_message_queue_get_number_pending(
register Message_queue_Control *the_message_queue; register Message_queue_Control *the_message_queue;
Objects_Locations location; Objects_Locations location;
if ( !count )
return RTEMS_INVALID_ADDRESS;
the_message_queue = _Message_queue_Get( id, &location ); the_message_queue = _Message_queue_Get( id, &location );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: case OBJECTS_REMOTE:

View File

@@ -61,6 +61,12 @@ rtems_status_code rtems_message_queue_receive(
Objects_Locations location; Objects_Locations location;
boolean wait; boolean wait;
if ( !buffer )
return RTEMS_INVALID_ADDRESS;
if ( !size )
return RTEMS_INVALID_ADDRESS;
the_message_queue = _Message_queue_Get( id, &location ); the_message_queue = _Message_queue_Get( id, &location );
switch ( location ) { switch ( location ) {

View File

@@ -69,6 +69,9 @@ rtems_status_code _Message_queue_Submit(
Objects_Locations location; Objects_Locations location;
CORE_message_queue_Status msg_status; CORE_message_queue_Status msg_status;
if ( !buffer )
return RTEMS_INVALID_ADDRESS;
the_message_queue = _Message_queue_Get( id, &location ); the_message_queue = _Message_queue_Get( id, &location );
switch ( location ) switch ( location )
{ {

View File

@@ -47,7 +47,7 @@ rtems_status_code rtems_partition_create(
void *starting_address, void *starting_address,
unsigned32 length, unsigned32 length,
unsigned32 buffer_size, unsigned32 buffer_size,
rtems_attribute attribute_set, rtems_attribute attribute_set,
Objects_Id *id Objects_Id *id
) )
{ {
@@ -56,6 +56,12 @@ rtems_status_code rtems_partition_create(
if ( !rtems_is_name_valid( name ) ) if ( !rtems_is_name_valid( name ) )
return RTEMS_INVALID_NAME; return RTEMS_INVALID_NAME;
if ( !starting_address )
return RTEMS_INVALID_ADDRESS;
if ( !id )
return RTEMS_INVALID_ADDRESS;
if ( length == 0 || buffer_size == 0 || length < buffer_size || if ( length == 0 || buffer_size == 0 || length < buffer_size ||
!_Partition_Is_buffer_size_aligned( buffer_size ) ) !_Partition_Is_buffer_size_aligned( buffer_size ) )
return RTEMS_INVALID_SIZE; return RTEMS_INVALID_SIZE;

View File

@@ -34,7 +34,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_partition_delete( rtems_status_code rtems_partition_delete(
@@ -42,7 +42,7 @@ rtems_status_code rtems_partition_delete(
) )
{ {
register Partition_Control *the_partition; register Partition_Control *the_partition;
Objects_Locations location; Objects_Locations location;
the_partition = _Partition_Get( id, &location ); the_partition = _Partition_Get( id, &location );
switch ( location ) { switch ( location ) {

View File

@@ -46,6 +46,9 @@ rtems_status_code rtems_partition_get_buffer(
Objects_Locations location; Objects_Locations location;
void *the_buffer; void *the_buffer;
if ( !buffer )
return RTEMS_INVALID_ADDRESS;
the_partition = _Partition_Get( id, &location ); the_partition = _Partition_Get( id, &location );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: case OBJECTS_REMOTE:

View File

@@ -31,7 +31,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful and caller is not the owning thread * RTEMS_SUCCESSFUL - if successful and caller is not the owning thread
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_rate_monotonic_cancel( rtems_status_code rtems_rate_monotonic_cancel(
@@ -39,7 +39,7 @@ rtems_status_code rtems_rate_monotonic_cancel(
) )
{ {
Rate_monotonic_Control *the_period; Rate_monotonic_Control *the_period;
Objects_Locations location; Objects_Locations location;
the_period = _Rate_monotonic_Get( id, &location ); the_period = _Rate_monotonic_Get( id, &location );
switch ( location ) { switch ( location ) {

View File

@@ -32,9 +32,9 @@
* id - pointer to rate monotonic id * id - pointer to rate monotonic id
* *
* Output parameters: * Output parameters:
* id - rate monotonic id * id - rate monotonic id
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_rate_monotonic_create( rtems_status_code rtems_rate_monotonic_create(
@@ -47,6 +47,9 @@ rtems_status_code rtems_rate_monotonic_create(
if ( !rtems_is_name_valid( name ) ) if ( !rtems_is_name_valid( name ) )
return RTEMS_INVALID_NAME; return RTEMS_INVALID_NAME;
if ( !id )
return RTEMS_INVALID_ADDRESS;
_Thread_Disable_dispatch(); /* to prevent deletion */ _Thread_Disable_dispatch(); /* to prevent deletion */
the_period = _Rate_monotonic_Allocate(); the_period = _Rate_monotonic_Allocate();

View File

@@ -31,7 +31,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_rate_monotonic_delete( rtems_status_code rtems_rate_monotonic_delete(
@@ -39,7 +39,7 @@ rtems_status_code rtems_rate_monotonic_delete(
) )
{ {
Rate_monotonic_Control *the_period; Rate_monotonic_Control *the_period;
Objects_Locations location; Objects_Locations location;
the_period = _Rate_monotonic_Get( id, &location ); the_period = _Rate_monotonic_Get( id, &location );
switch ( location ) { switch ( location ) {

View File

@@ -45,7 +45,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
Objects_Locations location; Objects_Locations location;
Rate_monotonic_Control *the_period; Rate_monotonic_Control *the_period;
if ( status == NULL ) if ( !status )
return RTEMS_INVALID_ADDRESS; return RTEMS_INVALID_ADDRESS;
the_period = _Rate_monotonic_Get( id, &location ); the_period = _Rate_monotonic_Get( id, &location );

View File

@@ -32,9 +32,9 @@
* id - pointer to period id * id - pointer to period id
* *
* Output parameters: * Output parameters:
* *id - region id * *id - region id
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_rate_monotonic_ident( rtems_status_code rtems_rate_monotonic_ident(

View File

@@ -32,7 +32,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_rate_monotonic_period( rtems_status_code rtems_rate_monotonic_period(

View File

@@ -48,7 +48,7 @@ rtems_status_code rtems_region_create(
void *starting_address, void *starting_address,
unsigned32 length, unsigned32 length,
unsigned32 page_size, unsigned32 page_size,
rtems_attribute attribute_set, rtems_attribute attribute_set,
Objects_Id *id Objects_Id *id
) )
{ {
@@ -57,6 +57,12 @@ rtems_status_code rtems_region_create(
if ( !rtems_is_name_valid( name ) ) if ( !rtems_is_name_valid( name ) )
return RTEMS_INVALID_NAME; return RTEMS_INVALID_NAME;
if ( !starting_address )
return RTEMS_INVALID_ADDRESS;
if ( !id )
return RTEMS_INVALID_ADDRESS;
if ( !_Addresses_Is_aligned( starting_address ) ) if ( !_Addresses_Is_aligned( starting_address ) )
return RTEMS_INVALID_ADDRESS; return RTEMS_INVALID_ADDRESS;

View File

@@ -35,7 +35,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_region_delete( rtems_status_code rtems_region_delete(
@@ -43,7 +43,7 @@ rtems_status_code rtems_region_delete(
) )
{ {
register Region_Control *the_region; register Region_Control *the_region;
Objects_Locations location; Objects_Locations location;
_RTEMS_Lock_allocator(); _RTEMS_Lock_allocator();
the_region = _Region_Get( id, &location ); the_region = _Region_Get( id, &location );

View File

@@ -51,6 +51,9 @@ rtems_status_code rtems_region_extend(
Heap_Extend_status heap_status; Heap_Extend_status heap_status;
rtems_status_code status; rtems_status_code status;
if ( !starting_address )
return RTEMS_INVALID_ADDRESS;
status = RTEMS_SUCCESSFUL; status = RTEMS_SUCCESSFUL;
_RTEMS_Lock_allocator(); /* to prevent deletion */ _RTEMS_Lock_allocator(); /* to prevent deletion */

View File

@@ -54,6 +54,9 @@ rtems_status_code rtems_region_get_segment(
Thread_Control *executing; Thread_Control *executing;
void *the_segment; void *the_segment;
if ( !segment )
return RTEMS_INVALID_ADDRESS;
*segment = NULL; *segment = NULL;
if ( size == 0 ) if ( size == 0 )

View File

@@ -49,6 +49,12 @@ rtems_status_code rtems_region_get_segment_size(
Objects_Locations location; Objects_Locations location;
Thread_Control *executing; Thread_Control *executing;
if ( !segment )
return RTEMS_INVALID_ADDRESS;
if ( !size )
return RTEMS_INVALID_ADDRESS;
_RTEMS_Lock_allocator(); _RTEMS_Lock_allocator();
executing = _Thread_Executing; executing = _Thread_Executing;
the_region = _Region_Get( id, &location ); the_region = _Region_Get( id, &location );

View File

@@ -42,7 +42,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_region_return_segment( rtems_status_code rtems_region_return_segment(

View File

@@ -81,6 +81,9 @@ rtems_status_code rtems_semaphore_create(
if ( !rtems_is_name_valid( name ) ) if ( !rtems_is_name_valid( name ) )
return RTEMS_INVALID_NAME; return RTEMS_INVALID_NAME;
if ( !id )
return RTEMS_INVALID_ADDRESS;
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
if ( _Attributes_Is_global( attribute_set ) ) { if ( _Attributes_Is_global( attribute_set ) ) {

View File

@@ -58,7 +58,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)

View File

@@ -48,7 +48,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)

View File

@@ -58,9 +58,9 @@
* id - pointer to semaphore id * id - pointer to semaphore id
* *
* Output parameters: * Output parameters:
* *id - semaphore id * *id - semaphore id
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_semaphore_ident( rtems_status_code rtems_semaphore_ident(

View File

@@ -75,6 +75,9 @@ rtems_status_code rtems_task_create(
if ( !rtems_is_name_valid( name ) ) if ( !rtems_is_name_valid( name ) )
return RTEMS_INVALID_NAME; return RTEMS_INVALID_NAME;
if ( !id )
return RTEMS_INVALID_ADDRESS;
/* /*
* Core Thread Initialize insures we get the minimum amount of * Core Thread Initialize insures we get the minimum amount of
* stack space. * stack space.

View File

@@ -41,9 +41,9 @@
* note - pointer to note * note - pointer to note
* *
* Output parameters: * Output parameters:
* note - filled in if successful * note - filled in if successful
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_task_get_note( rtems_status_code rtems_task_get_note(
@@ -56,6 +56,9 @@ rtems_status_code rtems_task_get_note(
Objects_Locations location; Objects_Locations location;
RTEMS_API_Control *api; RTEMS_API_Control *api;
if ( !note )
return RTEMS_INVALID_ADDRESS;
/* /*
* NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would * NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would
* be checking an unsigned number for being negative. * be checking an unsigned number for being negative.

View File

@@ -58,6 +58,9 @@ rtems_status_code rtems_task_mode(
boolean needs_asr_dispatching = FALSE; boolean needs_asr_dispatching = FALSE;
rtems_mode old_mode; rtems_mode old_mode;
if ( !previous_mode_set )
return RTEMS_INVALID_ADDRESS;
executing = _Thread_Executing; executing = _Thread_Executing;
api = executing->API_Extensions[ THREAD_API_RTEMS ]; api = executing->API_Extensions[ THREAD_API_RTEMS ];
asr = &api->Signal; asr = &api->Signal;

View File

@@ -43,7 +43,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_task_restart( rtems_status_code rtems_task_restart(

View File

@@ -40,7 +40,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_task_resume( rtems_status_code rtems_task_resume(

View File

@@ -42,7 +42,7 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_task_set_note( rtems_status_code rtems_task_set_note(

View File

@@ -49,7 +49,7 @@ rtems_status_code rtems_task_suspend(
) )
{ {
register Thread_Control *the_thread; register Thread_Control *the_thread;
Objects_Locations location; Objects_Locations location;
the_thread = _Thread_Get( id, &location ); the_thread = _Thread_Get( id, &location );
switch ( location ) { switch ( location ) {

View File

@@ -32,6 +32,9 @@ rtems_status_code rtems_task_variable_add(
Objects_Locations location; Objects_Locations location;
rtems_task_variable_t *tvp, *new; rtems_task_variable_t *tvp, *new;
if ( !ptr )
return RTEMS_INVALID_ADDRESS;
the_thread = _Thread_Get (tid, &location); the_thread = _Thread_Get (tid, &location);
switch (location) { switch (location) {
case OBJECTS_REMOTE: case OBJECTS_REMOTE:

View File

@@ -31,6 +31,9 @@ rtems_status_code rtems_task_variable_delete(
Objects_Locations location; Objects_Locations location;
rtems_task_variable_t *tvp, *prev; rtems_task_variable_t *tvp, *prev;
if ( !ptr )
return RTEMS_INVALID_ADDRESS;
prev = NULL; prev = NULL;
the_thread = _Thread_Get (tid, &location); the_thread = _Thread_Get (tid, &location);

View File

@@ -32,6 +32,12 @@ rtems_status_code rtems_task_variable_get(
Objects_Locations location; Objects_Locations location;
rtems_task_variable_t *tvp; rtems_task_variable_t *tvp;
if ( !ptr )
return RTEMS_INVALID_ADDRESS;
if ( !result )
return RTEMS_INVALID_ADDRESS;
the_thread = _Thread_Get (tid, &location); the_thread = _Thread_Get (tid, &location);
switch (location) { switch (location) {
case OBJECTS_REMOTE: case OBJECTS_REMOTE:

View File

@@ -40,11 +40,11 @@
* *
* Output parameters: * Output parameters:
* RTEMS_SUCCESSFUL - if successful * RTEMS_SUCCESSFUL - if successful
* error code - if unsuccessful * error code - if unsuccessful
*/ */
rtems_status_code rtems_task_wake_when( rtems_status_code rtems_task_wake_when(
rtems_time_of_day *time_buffer rtems_time_of_day *time_buffer
) )
{ {
Watchdog_Interval seconds; Watchdog_Interval seconds;
@@ -52,6 +52,9 @@ rtems_time_of_day *time_buffer
if ( !_TOD_Is_set ) if ( !_TOD_Is_set )
return RTEMS_NOT_DEFINED; return RTEMS_NOT_DEFINED;
if ( !time_buffer )
return RTEMS_INVALID_ADDRESS;
time_buffer->ticks = 0; time_buffer->ticks = 0;
if ( !_TOD_Validate( time_buffer ) ) if ( !_TOD_Validate( time_buffer ) )

View File

@@ -47,6 +47,9 @@ rtems_status_code rtems_timer_create(
if ( !rtems_is_name_valid( name ) ) if ( !rtems_is_name_valid( name ) )
return RTEMS_INVALID_NAME; return RTEMS_INVALID_NAME;
if ( !id )
return RTEMS_INVALID_ADDRESS;
_Thread_Disable_dispatch(); /* to prevent deletion */ _Thread_Disable_dispatch(); /* to prevent deletion */
the_timer = _Timer_Allocate(); the_timer = _Timer_Allocate();

View File

@@ -39,8 +39,8 @@ rtems_status_code rtems_timer_delete(
Objects_Id id Objects_Id id
) )
{ {
Timer_Control *the_timer; Timer_Control *the_timer;
Objects_Locations location; Objects_Locations location;
the_timer = _Timer_Get( id, &location ); the_timer = _Timer_Get( id, &location );
switch ( location ) { switch ( location ) {

View File

@@ -51,6 +51,9 @@ rtems_status_code rtems_timer_fire_after(
if ( ticks == 0 ) if ( ticks == 0 )
return RTEMS_INVALID_NUMBER; return RTEMS_INVALID_NUMBER;
if ( !routine )
return RTEMS_INVALID_ADDRESS;
the_timer = _Timer_Get( id, &location ); the_timer = _Timer_Get( id, &location );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: /* should never return this */ case OBJECTS_REMOTE: /* should never return this */

View File

@@ -55,6 +55,9 @@ rtems_status_code rtems_timer_fire_when(
if ( !_TOD_Validate( wall_time ) ) if ( !_TOD_Validate( wall_time ) )
return RTEMS_INVALID_CLOCK; return RTEMS_INVALID_CLOCK;
if ( !routine )
return RTEMS_INVALID_ADDRESS;
seconds = _TOD_To_seconds( wall_time ); seconds = _TOD_To_seconds( wall_time );
if ( seconds <= _TOD_Seconds_since_epoch ) if ( seconds <= _TOD_Seconds_since_epoch )
return RTEMS_INVALID_CLOCK; return RTEMS_INVALID_CLOCK;

View File

@@ -53,6 +53,9 @@ rtems_status_code rtems_timer_server_fire_after(
if ( !_Timer_Server ) if ( !_Timer_Server )
return RTEMS_INCORRECT_STATE; return RTEMS_INCORRECT_STATE;
if ( !routine )
return RTEMS_INVALID_ADDRESS;
if ( ticks == 0 ) if ( ticks == 0 )
return RTEMS_INVALID_NUMBER; return RTEMS_INVALID_NUMBER;

View File

@@ -57,6 +57,9 @@ rtems_status_code rtems_timer_server_fire_when(
if ( !_TOD_Is_set ) if ( !_TOD_Is_set )
return RTEMS_NOT_DEFINED; return RTEMS_NOT_DEFINED;
if ( !routine )
return RTEMS_INVALID_ADDRESS;
if ( !_TOD_Validate( wall_time ) ) if ( !_TOD_Validate( wall_time ) )
return RTEMS_INVALID_CLOCK; return RTEMS_INVALID_CLOCK;