From c3638fece1a3b96349b7df11261e6661b101ccbe Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 24 Aug 2018 13:58:49 -0700 Subject: session: fix coverity warnings Change-Id: I2a25bba675fc9c84e5d391533e92b9a041637405 Signed-off-by: Florin Coras --- src/vnet/session/application_interface.c | 4 ++-- src/vnet/session/session_api.c | 3 +++ src/vnet/session/session_node.c | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c index f8d43d40882..2e631363016 100644 --- a/src/vnet/session/application_interface.c +++ b/src/vnet/session/application_interface.c @@ -530,7 +530,7 @@ vnet_bind_uri (vnet_bind_args_t * a) rv = parse_uri (a->uri, &sep); if (rv) return rv; - clib_memcpy (&a->sep, &sep, sizeof (sep)); + clib_memcpy (&a->sep_ext, &sep, sizeof (sep)); return vnet_bind_i (a); } @@ -568,7 +568,7 @@ vnet_connect_uri (vnet_connect_args_t * a) if (rv) return clib_error_return_code (0, rv, 0, "app init: %d", rv); - clib_memcpy (&a->sep, &sep, sizeof (sep)); + clib_memcpy (&a->sep_ext, &sep, sizeof (sep)); if ((rv = application_connect (a))) return clib_error_return_code (0, rv, 0, "connect failed"); return 0; diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index d573261d262..c12354fdeae 100755 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -1261,6 +1261,9 @@ vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp) goto done; } + /* Make coverity happy */ + ASSERT (args.evt_q && args.segment); + /* Send fifo segment fd if needed */ if (ssvm_type (args.segment) == SSVM_SEGMENT_MEMFD) { diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 1656e2eed0e..fcb3a3dc016 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -132,12 +132,16 @@ session_mq_disconnected_handler (void *data) int rv = 0; mp = (session_disconnected_msg_t *) data; - s = session_get_from_handle_if_valid (mp->handle); + if (!(s = session_get_from_handle_if_valid (mp->handle))) + { + clib_warning ("could not disconnect handle %llu", mp->handle); + return; + } app_wrk = app_worker_get (s->app_wrk_index); app = application_lookup (mp->client_index); - if (!(app_wrk && s && app->app_index == app_wrk->app_index)) + if (!(app_wrk && app && app->app_index == app_wrk->app_index)) { - clib_warning ("could not disconnect session: %llu app_wrk: %u", + clib_warning ("could not disconnect session: %llu app: %u", mp->handle, mp->client_index); return; } -- cgit 1.2.3-korg