mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-18 23:44:04 +02:00
45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
This issue is under review:
|
|
https://www.rtems.org/bugzilla/show_bug.cgi?id=1964
|
|
|
|
Doubly-linked lists ("chains") in RTEMS have a "control" block that
|
|
looks like the next/prev link pair in an element. The list elements
|
|
link both ways to this control block.
|
|
|
|
_Chain_Is_first and _Chain_Is_last only probed if the link to the
|
|
next element - which would be the control block - is non-NULL.
|
|
Telling by the function description and given that there are already
|
|
functions called _Chain_Is_head and _Chain_Is_tail (which could be
|
|
simplified), this is probably not the intended behaviour.
|
|
|
|
This also affects the aliases rtems_chain_is_first and
|
|
rtems_chain_is_last.
|
|
|
|
These functions are not used a lot and I haven't seen any immediate
|
|
effect on M1 after changing them, so I can't say whether this patch
|
|
may unearth other problems.
|
|
|
|
- Werner
|
|
|
|
Index: rtems/cpukit/score/inline/rtems/score/chain.inl
|
|
===================================================================
|
|
--- rtems.orig/cpukit/score/inline/rtems/score/chain.inl 2011-11-12 09:12:46.000000000 -0300
|
|
+++ rtems/cpukit/score/inline/rtems/score/chain.inl 2011-11-12 09:13:47.000000000 -0300
|
|
@@ -297,7 +297,7 @@
|
|
const Chain_Node *the_node
|
|
)
|
|
{
|
|
- return (the_node->previous == NULL);
|
|
+ return the_node->previous->previous == NULL;
|
|
}
|
|
|
|
/** @brief Is this the Last Node on the Chain
|
|
@@ -314,7 +314,7 @@
|
|
const Chain_Node *the_node
|
|
)
|
|
{
|
|
- return (the_node->next == NULL);
|
|
+ return the_node->next->next == NULL;
|
|
}
|
|
|
|
/** @brief Does this Chain have only One Node
|