[ltt-dev] [PATCH] wfqueue: fix type-incorrect assignment

Mathieu Desnoyers compudj at krystal.dyndns.org
Tue Aug 9 08:35:35 EDT 2011


* Paolo Bonzini (pbonzini at redhat.com) wrote:
> The "old_tail = q->tail, q->tail = node" assignment in wfqueue
> is not type safe; q->tail is a pointer to pointer to node and the
> correct value to assign is &node->next.  While the arithmetic is
> the same, it is better to be tidy.

Merged, thanks!

Mathieu

> 
> Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> ---
>  urcu/static/wfqueue.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/urcu/static/wfqueue.h b/urcu/static/wfqueue.h
> index 77828ca..19314f5 100644
> --- a/urcu/static/wfqueue.h
> +++ b/urcu/static/wfqueue.h
> @@ -75,7 +75,7 @@ static inline void _cds_wfq_enqueue(struct cds_wfq_queue *q,
>  	 * structure containing node and setting node->next to NULL before
>  	 * publication.
>  	 */
> -	old_tail = uatomic_xchg(&q->tail, node);
> +	old_tail = uatomic_xchg(&q->tail, &node->next);
>  	/*
>  	 * At this point, dequeuers see a NULL old_tail->next, which indicates
>  	 * that the queue is being appended to. The following store will append
> -- 
> 1.7.6
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list