Casting the node returned by rtems_chain_head is incorrect. That node is owned by the control structure and use of it post-cast could cause memory corruption. --- c-user/chains.rst | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/c-user/chains.rst b/c-user/chains.rst index f518ef4..e791d10 100644 --- a/c-user/chains.rst +++ b/c-user/chains.rst @@ -193,6 +193,10 @@ placed on another chain: rtems_chain_initialize_empty (out); node = rtems_chain_head (chain); + + /* The node returned by rtems_chain_head() is owned by the chain */ + node = node->next; + while (!rtems_chain_is_tail (chain, node)) { bar = (foo*) node; -- 2.30.2 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel