mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-25 22:07:15 +00:00
Patch from Chris Johns <ccj@acm.org>:
joel@OARcorp.com wrote: > > Chris, > > sp09 fails on the rtems_port_delete(0) call. This is supposed to give an > invalid id error. I can't find any changes other than the unlimited > objects patch which would have tripped this so would appreciate it if you > could look into it. I suspect that this is a side-effect of the unlimited > objects patch. > It is me. > > Basically, there are 0 ports configured in sp09. The test ends up > dereferecing NULL in local_table[0] and comes up with a non-NULL invalid > pointer. > The issue is not actually allocating a local_table for an object type which has a maximum value of 0. I cannot remember the exact workings of the id values and the local_table. I might have changed the nature from the pre-unlimited change. As you know the id's are an interesting game where performance is most important. > > I know the problem could be solved by adding a check for index == 0. But > I hate to slow this path down. I think you may have changed the way the > object information structure gets initialized. > ---- CVS log ---- This change lets the unlimited and sp09 tests run on the posix Linux BSP. A static local variable `null_local_table' has been added. This variable is always set to NULL. The `**local_table' element of the information structure is set to point to this variable earily in the initialisation. If the object type has more than 0 elements the `local_table' element is updated. All object types which have 0 elements reference `null_local_table'. This change fixes the problem sp09 found yet does not add any extra processing to the critical `_Objects_Get_local_object' function. ---- CVS log ----
This commit is contained in:
@@ -95,10 +95,10 @@ void _Objects_Extend_information(
|
||||
*/
|
||||
|
||||
minimum_index = _Objects_Get_index( information->minimum_id );
|
||||
index_base = minimum_index;
|
||||
block = 0;
|
||||
index_base = minimum_index;
|
||||
block = 0;
|
||||
|
||||
if (information->maximum < minimum_index)
|
||||
if ( information->maximum < minimum_index )
|
||||
block_count = 0;
|
||||
else {
|
||||
block_count = information->maximum / information->allocation_size;
|
||||
@@ -439,6 +439,8 @@ void _Objects_Initialize_information(
|
||||
boolean is_thread
|
||||
)
|
||||
{
|
||||
static Objects_Control *null_local_table = NULL;
|
||||
|
||||
unsigned32 minimum_index;
|
||||
unsigned32 index;
|
||||
unsigned32 name_length;
|
||||
@@ -471,7 +473,7 @@ void _Objects_Initialize_information(
|
||||
*/
|
||||
|
||||
information->auto_extend = (maximum & OBJECTS_UNLIMITED_OBJECTS) ? TRUE : FALSE;
|
||||
maximum &= ~OBJECTS_UNLIMITED_OBJECTS;
|
||||
maximum &= ~OBJECTS_UNLIMITED_OBJECTS;
|
||||
|
||||
/*
|
||||
* The allocation unit is the maximum value
|
||||
@@ -479,6 +481,12 @@ void _Objects_Initialize_information(
|
||||
|
||||
information->allocation_size = maximum;
|
||||
|
||||
/*
|
||||
* Provide a null local table entry for the case of any empty table.
|
||||
*/
|
||||
|
||||
information->local_table = &null_local_table;
|
||||
|
||||
/*
|
||||
* Calculate minimum and maximum Id's
|
||||
*/
|
||||
@@ -495,7 +503,7 @@ void _Objects_Initialize_information(
|
||||
|
||||
name_length = maximum_name_length;
|
||||
|
||||
if (name_length & (OBJECTS_NAME_ALIGNMENT-1))
|
||||
if ( name_length & (OBJECTS_NAME_ALIGNMENT-1) )
|
||||
name_length = (name_length + OBJECTS_NAME_ALIGNMENT) &
|
||||
~(OBJECTS_NAME_ALIGNMENT-1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user