util: Fix definition of LIST_FOR_EACH_CONTINUE macro.
authorMauricio Vásquez <mauricio.vasquezbernal@studenti.polito.it>
Fri, 2 Oct 2015 11:23:31 +0000 (13:23 +0200)
committerBen Pfaff <blp@nicira.com>
Fri, 2 Oct 2015 13:24:38 +0000 (06:24 -0700)
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.

This does not fix any observable bug because LIST_FOR_EACH_CONTINUE is not
used anywhere.

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
Signed-off-by: Ben Pfaff <blp@nicira.com>
AUTHORS
lib/list.h

diff --git a/AUTHORS b/AUTHORS
index 6e5bbab..99bcf60 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -125,6 +125,7 @@ Mark Maglana            mmaglana@gmail.com
 Martin Casado           casado@nicira.com
 Martino Fornasa         mf@fornasa.it
 Maryam Tahhan           maryam.tahhan@intel.com
+Mauricio Vásquez        mauricio.vasquezbernal@studenti.polito.it
 Mehak Mahajan           mmahajan@nicira.com
 Michal Weglicki         michalx.weglicki@intel.com
 Mijo Safradin           mijo@linux.vnet.ibm.com
index 5ad54b8..db4a613 100644 (file)
@@ -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)                       \