From 8f544964a3df144a441b136c2a01427eca731eea Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 18 Jan 2017 10:23:22 -0500 Subject: Fix coverity warnings, VPP-608 Change-Id: Ib0144ba3a9a09971d3946c932e8fed6d5c1ad278 Signed-off-by: Dave Barach --- src/vnet/devices/virtio/vhost-user.c | 8 ++++++-- src/vnet/unix/tapcli.c | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/devices/virtio/vhost-user.c b/src/vnet/devices/virtio/vhost-user.c index 9a7c1dc0832..ac14286747a 100644 --- a/src/vnet/devices/virtio/vhost-user.c +++ b/src/vnet/devices/virtio/vhost-user.c @@ -2326,12 +2326,16 @@ vhost_user_process (vlib_main_t * vm, sizeof (sun.sun_path) - 1); /* Avoid hanging VPP if the other end does not accept */ - fcntl(sockfd, F_SETFL, O_NONBLOCK); + if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) + clib_unix_warning ("fcntl"); + if (connect (sockfd, (struct sockaddr *) &sun, sizeof (struct sockaddr_un)) == 0) { /* Set the socket to blocking as it was before */ - fcntl(sockfd, F_SETFL, 0); + if (fcntl(sockfd, F_SETFL, 0) < 0) + clib_unix_warning ("fcntl2"); + vui->sock_errno = 0; template.file_descriptor = sockfd; template.private_data = diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c index 2d3082cbf70..e9dbf729141 100644 --- a/src/vnet/unix/tapcli.c +++ b/src/vnet/unix/tapcli.c @@ -899,8 +899,9 @@ int vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t *ap) /* ip4: mask defaults to /24 */ u32 mask = clib_host_to_net_u32 (0xFFFFFF00); + memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; - sin.sin_port = 0; + /* sin.sin_port = 0; */ sin.sin_addr.s_addr = ap->ip4_address->as_u32; memcpy (&ifr.ifr_ifru.ifru_addr, &sin, sizeof (sin)); @@ -1294,7 +1295,7 @@ tap_connect_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - u8 * intfc_name; + u8 * intfc_name = 0; unformat_input_t _line_input, *line_input = &_line_input; vnet_tap_connect_args_t _a, *ap= &_a; tapcli_main_t * tm = &tapcli_main; -- cgit 1.2.3-korg