Notice: We have migrated to GitLab launching 2024-05-01 see here:

#3360 closed defect (fixed)

4.10: _Chain_Is_first/last overshoot

Reported by: Gedare Bloom Owned by: Gedare Bloom
Priority: normal Milestone: 4.10.3
Component: score Version: 4.10
Severity: normal Keywords:
Cc: Blocked By:


A user reported a possible problem with the implementation of the _Chain_Is_first/last functions:

Subject: [Milkymist-devel] [PATCH, tentative] RTEMS: _Chain_Is_first/last overshoot
Date: Wed, 9 Nov 2011 16:53:53 -0300
From: Werner Almesberger <werner@…>
Reply-To: Milkymist One, Milkymist SoC and Flickernoise developers' list <devel@…>
To: Milkymist One, Milkymist SoC and Flickernoise developers' list <devel@…>

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

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

Change History (2)

comment:1 Changed on 03/23/18 at 14:48:01 by Gedare Bloom

In [changeset:"991e1b85947e5cf0a079fc8e566aa3a563a8b5e0/rtems" 991e1b85/rtems]:

(The changeset message doesn't reference this ticket)

comment:2 Changed on 03/23/18 at 14:48:35 by Gedare Bloom

Resolution: fixed
Status: assignedclosed

Fixed In [changeset:"991e1b85947e5cf0a079fc8e566aa3a563a8b5e0/rtems" 991e1b85/rtems]

Note: See TracTickets for help on using tickets.