summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/device.c
diff options
context:
space:
mode:
authorMilan Lenco <milan.lenco@pantheon.tech>2017-03-31 14:51:18 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2017-04-03 11:20:10 +0000
commitc966ecd11ccb4e2ad8e92385a4935c8fd4586a2d (patch)
tree5a581088859256baf02f24b337c8a9790db23dfa /src/plugins/memif/device.c
parentc4ba20fe05d0c10da6a244e77b756dab27c76d8a (diff)
Fix memif coverity issues
Change-Id: I844ec53b55ceaa1e00996f5cf8a018537ea8b481 Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
Diffstat (limited to 'src/plugins/memif/device.c')
-rw-r--r--src/plugins/memif/device.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index 4faeb0554f3..70bdb48ba9c 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -193,7 +193,7 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
CLIB_MEMORY_STORE_BARRIER ();
ring->head = head;
- clib_spinlock_unlock (&mif->lockp);
+ clib_spinlock_unlock_if_init (&mif->lockp);
if (n_left)
{
@@ -255,9 +255,11 @@ static clib_error_t *
memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
memif_main_t *apm = &memif_main;
- memif_msg_t msg;
+ vlib_main_t *vm = vlib_get_main ();
+ memif_msg_t msg = { 0 };
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
memif_if_t *mif = pool_elt_at_index (apm->interfaces, hw->dev_instance);
+ static clib_error_t *error = 0;
if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
mif->flags |= MEMIF_IF_FLAG_ADMIN_UP;
@@ -269,11 +271,17 @@ memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
msg.version = MEMIF_VERSION;
msg.type = MEMIF_MSG_TYPE_DISCONNECT;
- send (mif->connection.fd, &msg, sizeof (msg), 0);
+ if (send (mif->connection.fd, &msg, sizeof (msg), 0) < 0)
+ {
+ clib_unix_warning ("Failed to send disconnect request");
+ error = clib_error_return_unix (0, "send fd %d",
+ mif->connection.fd);
+ memif_disconnect (vm, mif);
+ }
}
}
- return 0;
+ return error;
}
static clib_error_t *