While running ovn-controller under valgrind, I noticed several
variations of the same warning.  Switching this allocation from malloc
to zalloc resolves it.

For reference, some examples from valgrind are:

==8487== Conditional jump or move depends on uninitialised value(s)
==8487==    at 0x408935: hmap_next_with_hash__ (hmap.h:275)
==8487==    by 0x4088BF: hmap_first_with_hash (hmap.h:286)
==8487==    by 0x408357: ovn_flow_lookup (ofctrl.c:307)
==8487==    by 0x408259: ofctrl_add_flow (ofctrl.c:274)
==8487==    by 0x40B00F: pipeline_run (pipeline.c:330)
==8487==    by 0x408F65: main (ovn-controller.c:397)
==8487==
==8487== Use of uninitialised value of size 8
==8487==    at 0x4088B3: hmap_first_with_hash (hmap.h:286)
==8487==    by 0x408357: ovn_flow_lookup (ofctrl.c:307)
==8487==    by 0x408259: ofctrl_add_flow (ofctrl.c:274)
==8487==    by 0x40B00F: pipeline_run (pipeline.c:330)
==8487==    by 0x408F65: main (ovn-controller.c:397)

Signed-off-by: Russell Bryant <rbry...@redhat.com>
---
 ovn/controller/ofctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c
index 843e1a1..c26df56 100644
--- a/ovn/controller/ofctrl.c
+++ b/ovn/controller/ofctrl.c
@@ -264,7 +264,7 @@ void
 ofctrl_add_flow(uint8_t table_id, uint16_t priority,
                 const struct match *match, const struct ofpbuf *actions)
 {
-    struct ovn_flow *f = xmalloc(sizeof *f);
+    struct ovn_flow *f = xzalloc(sizeof *f);
     f->table_id = table_id;
     f->priority = priority;
     f->match = *match;
-- 
2.4.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to