I believe the macro CIRCLEQ_REPLACE in queue.h is incorrect.
The macro should be using a pointer to head. Otherwise CIRCLEQ_END(head) will
not be correct.
Please see the diff below.

Thanks
Michael Piszczek

--- a/src/sys/sys/queue.h
+++ b/src/sys/sys/queue.h
@@ -560,12 +560,12 @@ struct {
\
#define CIRCLEQ_REPLACE(head, elm, elm2, field) do {                   \
        if (((elm2)->field.cqe_next = (elm)->field.cqe_next) ==         \
            CIRCLEQ_END(head))                                          \
-               (head).cqh_last = (elm2);                               \
+               (head)->cqh_last = (elm2);                              \
        else                                                            \
                (elm2)->field.cqe_next->field.cqe_prev = (elm2);        \
        if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) ==         \
            CIRCLEQ_END(head))                                          \
-               (head).cqh_first = (elm2);                              \
+               (head)->cqh_first = (elm2);                             \
        else                                                            \
                (elm2)->field.cqe_prev->field.cqe_next = (elm2);        \
        _Q_INVALIDATE((elm)->field.cqe_prev);                           \

Reply via email to