qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] queue: fix QTAILQ_FOREACH_REVERSE_SAFE
@ 2019-02-04 15:43 Paolo Bonzini
  2019-02-04 16:09 ` Emilio G. Cota
  2019-02-04 16:27 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-02-04 15:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, thuth

The iteration was stopping as soon as prev_var was set to NULL, and
therefore it skipped the first element.  Fortunately, or unfortunately,
we have only one use of QTAILQ_FOREACH_REVERSE_SAFE.  Thus this only
showed up as incorrect register preferences on the very first translation
block that was compiled.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu/queue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index 1f8e219..0379bd8 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -439,7 +439,7 @@ union {                                                                 \
 
 #define QTAILQ_FOREACH_REVERSE_SAFE(var, head, field, prev_var)         \
         for ((var) = QTAILQ_LAST(head);                                 \
-             (var) && ((prev_var) = QTAILQ_PREV(var, field));           \
+             (var) && ((prev_var) = QTAILQ_PREV(var, field), 1);        \
              (var) = (prev_var))
 
 /*
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-04 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-04 15:43 [Qemu-devel] [PATCH] queue: fix QTAILQ_FOREACH_REVERSE_SAFE Paolo Bonzini
2019-02-04 16:09 ` Emilio G. Cota
2019-02-04 16:27 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).