summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-03-16 17:46:41 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-03-16 20:54:16 +0000
commitb6f93a1d1acf0f6ad2cdac0f0ea72842f36776a1 (patch)
tree6c333065a7356c59df36af392c248d041f89ce6d
parent1b33fde6bdf54de22fb97f1b0a6730a40fd6560f (diff)
vlib: additional runtime_data checks
Change-Id: I9b6ed9741fae89bdefa6f601398eb63a21155069 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/vlib/threads.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 3756c3fa3ee..40789f59ea5 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -681,9 +681,10 @@ start_workers (vlib_main_t * vm)
vlib_node_t *n = vlib_get_node (vm, rt->node_index);
rt->cpu_index = vm_clone->cpu_index;
/* copy initial runtime_data from node */
- if (n->runtime_data_bytes > 0)
+ if (n->runtime_data && n->runtime_data_bytes > 0)
clib_memcpy (rt->runtime_data, n->runtime_data,
- VLIB_NODE_RUNTIME_DATA_SIZE);
+ clib_min (VLIB_NODE_RUNTIME_DATA_SIZE,
+ n->runtime_data_bytes));
else if (CLIB_DEBUG > 0)
memset (rt->runtime_data, 0xfe,
VLIB_NODE_RUNTIME_DATA_SIZE);
@@ -696,9 +697,10 @@ start_workers (vlib_main_t * vm)
vlib_node_t *n = vlib_get_node (vm, rt->node_index);
rt->cpu_index = vm_clone->cpu_index;
/* copy initial runtime_data from node */
- if (n->runtime_data_bytes > 0)
+ if (n->runtime_data && n->runtime_data_bytes > 0)
clib_memcpy (rt->runtime_data, n->runtime_data,
- VLIB_NODE_RUNTIME_DATA_SIZE);
+ clib_min (VLIB_NODE_RUNTIME_DATA_SIZE,
+ n->runtime_data_bytes));
else if (CLIB_DEBUG > 0)
memset (rt->runtime_data, 0xfe,
VLIB_NODE_RUNTIME_DATA_SIZE);
@@ -961,8 +963,10 @@ vlib_worker_thread_node_runtime_update (void)
vlib_node_t *n = vlib_get_node (vm, rt->node_index);
rt->cpu_index = vm_clone->cpu_index;
/* copy runtime_data, will be overwritten later for existing rt */
- clib_memcpy (rt->runtime_data, n->runtime_data,
- VLIB_NODE_RUNTIME_DATA_SIZE);
+ if (n->runtime_data && n->runtime_data_bytes > 0)
+ clib_memcpy (rt->runtime_data, n->runtime_data,
+ clib_min (VLIB_NODE_RUNTIME_DATA_SIZE,
+ n->runtime_data_bytes));
}
for (j = 0; j < vec_len (old_rt); j++)
@@ -985,8 +989,10 @@ vlib_worker_thread_node_runtime_update (void)
vlib_node_t *n = vlib_get_node (vm, rt->node_index);
rt->cpu_index = vm_clone->cpu_index;
/* copy runtime_data, will be overwritten later for existing rt */
- clib_memcpy (rt->runtime_data, n->runtime_data,
- VLIB_NODE_RUNTIME_DATA_SIZE);
+ if (n->runtime_data && n->runtime_data_bytes > 0)
+ clib_memcpy (rt->runtime_data, n->runtime_data,
+ clib_min (VLIB_NODE_RUNTIME_DATA_SIZE,
+ n->runtime_data_bytes));
}
for (j = 0; j < vec_len (old_rt); j++)