[RTEMS Project] #4676: incorrect handling of "inactive_per_block" from "Objects_Information" structure
RTEMS trac
trac at rtems.org
Tue Jul 12 07:33:52 UTC 2022
#4676: incorrect handling of "inactive_per_block" from "Objects_Information"
structure
-------------------------------------------------+-------------------------
Reporter: Adrian Varlan | Owner: Sebastian
| Huber
Type: defect | Status: accepted
Priority: normal | Milestone: 5.2
Component: score | Version: 5
Severity: normal | Resolution:
Keywords: CONFIGURE_UNLIMITED_OBJECTS | Blocked By:
inactive_per_block |
Blocking: |
-------------------------------------------------+-------------------------
Changes (by Sebastian Huber):
* owner: (none) => Sebastian Huber
* status: new => accepted
Comment:
Thanks for the detailed bug report. Do you would like to add a test case
for this? If not, then I can do it.
I think the bug was introduced by:
{{{
commit 21275b58a5a69c3c838082ffc8a7a3641f32ea9a
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Nov 22 19:14:51 2018 +0100
score: Static Objects_Information initialization
Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do
not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.
Close #3621.
diff --git a/cpukit/score/src/objectallocate.c
b/cpukit/score/src/objectallocate.c
index 9213cf8eb7..ad73884a07 100644
--- a/cpukit/score/src/objectallocate.c
+++ b/cpukit/score/src/objectallocate.c
@@ -68,13 +68,18 @@ Objects_Control *_Objects_Allocate_unprotected(
}
if ( the_object != NULL ) {
+ Objects_Maximum objects_per_block;
Objects_Maximum block;
+ objects_per_block = information->objects_per_block;
block = _Objects_Get_index( the_object->id ) -
OBJECTS_INDEX_MINIMUM;
- block /= information->objects_per_block;
- information->inactive_per_block[ block ]--;
- information->inactive--;
+ if ( block > objects_per_block ) {
+ block /= objects_per_block;
+
+ information->inactive_per_block[ block ]--;
+ information->inactive--;
+ }
}
}
}}}
--
Ticket URL: <http://devel.rtems.org/ticket/4676#comment:1>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list