1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2025-04-21 12:27:27 +03:00

m1/patches/rtems/: pending RTEMS patches (relative to latest CVS)

This commit is contained in:
Werner Almesberger
2011-11-12 09:22:48 -03:00
parent 20283fe9c2
commit aa0022d973
5 changed files with 226 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
This issue is under consideration:
http://www.rtems.org/pipermail/rtems-users/2011-November/009097.html
There seem to be two issues in the original code:
- the "node" argument of the macro is not protected, which could lead
to very hard to find errors (this doesn't seem to cause any
immediate problems just now, but it's a lousy risk to take)
- more seriously, "offsetof" counts in bytes while arithmentic on the
"node" pointer counts in multiples of whatever size that object has
RTEMS with this patch applied runs well (on Milkymist), but I don't
know if the code in question actually is executed.
- Werner
Index: rtems/cpukit/score/include/rtems/score/rbtree.h
===================================================================
--- rtems.orig/cpukit/score/include/rtems/score/rbtree.h 2011-11-12 08:52:50.000000000 -0300
+++ rtems/cpukit/score/include/rtems/score/rbtree.h 2011-11-12 09:00:35.000000000 -0300
@@ -90,7 +90,9 @@
*
*/
#define _RBTree_Container_of(node,container_type, node_field_name) \
- ((container_type*) (node - offsetof(container_type,node_field_name)))
+ ((container_type*) ((void *) (node) - \
+ offsetof(container_type,node_field_name)))
+
/**
* This type indicates the direction.