From 6fd4d06f395cefdebe2a8e5c02c89e7792ae9a25 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 28 Sep 2009 23:00:20 +0000 Subject: [PATCH] 2009-09-28 Joel Sherrill * score/src/objectidtoname.c: Remove error which cannot be reached since API that calls this checks the error first. * score/src/objectsetname.c: Adjust handling of length. --- cpukit/ChangeLog | 6 ++++++ cpukit/score/src/objectidtoname.c | 10 ++++------ cpukit/score/src/objectsetname.c | 12 ++++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index c39197627f..df465ac799 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2009-09-28 Joel Sherrill + + * score/src/objectidtoname.c: Remove error which cannot be reached + since API that calls this checks the error first. + * score/src/objectsetname.c: Adjust handling of length. + 2009-09-28 Joel Sherrill * rtems/src/regiondelete.c, rtems/src/regiongetfreeinfo.c, diff --git a/cpukit/score/src/objectidtoname.c b/cpukit/score/src/objectidtoname.c index 7504d3dc3c..fc42a41fa6 100644 --- a/cpukit/score/src/objectidtoname.c +++ b/cpukit/score/src/objectidtoname.c @@ -20,8 +20,7 @@ #include #include -/*PAGE - * +/* * _Objects_Id_to_name * * DESCRIPTION: @@ -34,8 +33,6 @@ * name - pointer to location in which to store name * */ - - Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( Objects_Id id, Objects_Name *name @@ -48,8 +45,9 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( Objects_Control *the_object = (Objects_Control *) 0; Objects_Locations ignored_location; - if ( !name ) - return OBJECTS_INVALID_NAME; + /* + * Caller is trusted for name != NULL. + */ tmpId = (id == OBJECTS_ID_OF_SELF) ? _Thread_Executing->Object.id : id; diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c index b7e01102ca..dfc44f18ba 100644 --- a/cpukit/score/src/objectsetname.c +++ b/cpukit/score/src/objectsetname.c @@ -37,13 +37,13 @@ bool _Objects_Set_name( const char *s; s = name; - length = strnlen( name, information->name_length ) + 1; + length = strnlen( name, information->name_length ); #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES) if ( information->is_string ) { char *d; - d = _Workspace_Allocate( length ); + d = _Workspace_Allocate( length + 1 ); if ( !d ) return false; @@ -58,10 +58,10 @@ bool _Objects_Set_name( #endif { the_object->name.name_u32 = _Objects_Build_name( - ((0