Fix uninitialized stack local, VPP-581 75/4575/2
authorDave Barach <dave@barachs.net>
Thu, 5 Jan 2017 15:08:52 +0000 (10:08 -0500)
committerOle Trøan <otroan@employees.org>
Thu, 5 Jan 2017 17:03:15 +0000 (17:03 +0000)
Sporadically messes up the client message allocation ring, by setting
c->message_bounce[msg_id] non-zero. A day-1 bug, made blatantly
obvious by the python API language binding for no particular reason.

Manually cherry-picked from stable/1701 due to the recent tree
reorganization.

Change-Id: Ifa03c5487436cbe50a6204db48fd9ce4938e32bb
Signed-off-by: Dave Barach <dave@barachs.net>
src/vlibapi/api_shared.c
src/vlibmemory/memory_vlib.c

index 6a04fac..18067d1 100644 (file)
@@ -691,6 +691,8 @@ vl_msg_api_set_handlers (int id, char *name, void *handler, void *cleanup,
   vl_msg_api_msg_config_t cfg;
   vl_msg_api_msg_config_t *c = &cfg;
 
+  memset (c, 0, sizeof (*c));
+
   c->id = id;
   c->name = name;
   c->handler = handler;
index 1d40bcb..69f35d7 100644 (file)
@@ -347,6 +347,8 @@ memory_api_init (char *region_name)
   vl_msg_api_msg_config_t cfg;
   vl_msg_api_msg_config_t *c = &cfg;
 
+  memset (c, 0, sizeof (*c));
+
   if ((rv = vl_map_shmem (region_name, 1 /* is_vlib */ )) < 0)
     return rv;
 
@@ -360,6 +362,7 @@ memory_api_init (char *region_name)
     c->size = sizeof(vl_api_##n##_t);                           \
     c->traced = 1; /* trace, so these msgs print */             \
     c->replay = 0; /* don't replay client create/delete msgs */ \
+    c->message_bounce = 0; /* don't bounce this message */     \
     vl_msg_api_config(c);} while (0);
 
   foreach_vlib_api_msg;