summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-07-03 15:21:50 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-07-03 20:24:00 +0000
commit4bda2d955db6d61348f5da94acb72f0447a91f04 (patch)
tree17e906dab5708e121107c234a42ffb94d69ebd40
parentfc4828cdbed3f8d6cef8d02239f8603d789ac099 (diff)
misc: fix coverity warnings
Type: fix Ticket: VPP-1649 Change-Id: I93a393eca80065c379035478500e75e855f39b12 Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r--src/plugins/hs_apps/vcl/sock_test_server.c3
-rw-r--r--src/plugins/unittest/test_buffer.c2
-rw-r--r--src/vat/api_format.c4
-rwxr-xr-xsrc/vnet/ethernet/node.c5
4 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/hs_apps/vcl/sock_test_server.c b/src/plugins/hs_apps/vcl/sock_test_server.c
index 0714ccce01e..110ff3e183b 100644
--- a/src/plugins/hs_apps/vcl/sock_test_server.c
+++ b/src/plugins/hs_apps/vcl/sock_test_server.c
@@ -343,7 +343,8 @@ af_unix_echo (void)
af_unix_client_fd, nbytes, errno_val);
goto done;
}
-
+ /* Make the buffer is NULL-terminated. */
+ buffer[sizeof (buffer) - 1] = 0;
printf ("SERVER (AF_UNIX): RX (%d bytes) - '%s'\n", rv, buffer);
if (!strncmp (SOCK_TEST_MIXED_EPOLL_DATA, (const char *) buffer, nbytes))
diff --git a/src/plugins/unittest/test_buffer.c b/src/plugins/unittest/test_buffer.c
index e5a5643099c..18938d888bb 100644
--- a/src/plugins/unittest/test_buffer.c
+++ b/src/plugins/unittest/test_buffer.c
@@ -55,7 +55,7 @@ linearize_negative_current_data (vlib_main_t * vm)
b->current_length = 14 + data_size;
}
- vlib_buffer_chain_linearize (vm, vlib_get_buffer (vm, bi[0]));
+ (void) vlib_buffer_chain_linearize (vm, vlib_get_buffer (vm, bi[0]));
return 0;
}
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index e0d77a46b2b..5bba7efea46 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -18921,7 +18921,7 @@ static void
vl_api_mpls_route_details_t_handler (vl_api_mpls_route_details_t * mp)
{
vat_main_t *vam = &vat_main;
- int count = ntohl (mp->mr_route.mr_n_paths);
+ int count = (int) clib_net_to_host_u32 (mp->mr_route.mr_n_paths);
vl_api_fib_path_t *fp;
int i;
@@ -18941,7 +18941,7 @@ static void vl_api_mpls_route_details_t_handler_json
(vl_api_mpls_route_details_t * mp)
{
vat_main_t *vam = &vat_main;
- int count = ntohl (mp->mr_route.mr_n_paths);
+ int count = (int) clib_host_to_net_u32 (mp->mr_route.mr_n_paths);
vat_json_node_t *node = NULL;
vl_api_fib_path_t *fp;
int i;
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c
index 286ec3c0e78..eabcf42812c 100755
--- a/src/vnet/ethernet/node.c
+++ b/src/vnet/ethernet/node.c
@@ -2063,6 +2063,11 @@ ethernet_register_input_type (vlib_main_t * vm,
}
ti = ethernet_get_type_info (em, type);
+ if (ti == 0)
+ {
+ clib_warning ("type_info NULL for type %d", type);
+ return;
+ }
ti->node_index = node_index;
ti->next_index = vlib_node_add_next (vm,
ethernet_input_node.index, node_index);