[ovs-dev] [PATCH] lib/util.h: change definition of LIST_FOR_EACH_CONTINUE macro

Mauricio Vásquez mauricio.vasquezbernal at studenti.polito.it
Fri Oct 2 11:23:31 UTC 2015


The definition of the INIT_CONTAINER macro initializes ITER to NULL,
it will cause a segmentation fault when it is deferenced on
(ITER)->MEMBER.next, then, I changed it to the ASSIGN_CONTAINER macro that
does not initialize ITER.

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal at studenti.polito.it
>

---
 lib/list.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/list.h b/lib/list.h
index 5ad54b8..db4a613 100644
--- a/lib/list.h
+++ b/lib/list.h
@@ -62,7 +62,7 @@ static inline bool list_is_short(const struct ovs_list *);
          &(ITER)->MEMBER != (LIST);                                     \
          ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER))
 #define LIST_FOR_EACH_CONTINUE(ITER, MEMBER, LIST)                      \
-    for (INIT_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER);             \
+    for (ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER);             \
          &(ITER)->MEMBER != (LIST);                                     \
          ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER))
 #define LIST_FOR_EACH_REVERSE(ITER, MEMBER, LIST)                       \
--



More information about the dev mailing list