aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-04 19:47:52 -0700
committerMarco Varlese <marco.varlese@suse.de>2018-09-06 08:37:20 +0000
commit145987776f57de20e9724d58fe28796d40ffebfa (patch)
treeb63fb0f62472dc15660c9a1f6a721d33d04e8587
parentab2f6dbf9f7b7164a9810f4c80c8abf8463e42ad (diff)
vcl/session/svm: fix coverity warnings
Change-Id: I27532b3ab244dc95955e836a42b229a6e4e32818 Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/svm/queue.c2
-rw-r--r--src/vcl/vppcom.c9
-rwxr-xr-xsrc/vnet/session/session_api.c6
3 files changed, 12 insertions, 5 deletions
diff --git a/src/svm/queue.c b/src/svm/queue.c
index 771033d7d8a..6a578fb4d6b 100644
--- a/src/svm/queue.c
+++ b/src/svm/queue.c
@@ -122,7 +122,7 @@ svm_queue_send_signal (svm_queue_t * q, u8 is_prod)
{
int __clib_unused rv, fd;
u64 data = 1;
- ASSERT (q->consumer_evtfd != -1);
+ ASSERT (q->consumer_evtfd > 0 && q->producer_evtfd > 0);
fd = is_prod ? q->producer_evtfd : q->consumer_evtfd;
rv = write (fd, &data, sizeof (data));
}
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 60d5eb3539a..1991e3e7277 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1635,6 +1635,8 @@ vcl_select_handle_mq (vcl_worker_t * wrk, svm_msg_q_t * mq,
case FIFO_EVENT_APP_RX:
sid = e->fifo->client_session_index;
session = vcl_session_get (wrk, sid);
+ if (!session)
+ break;
if (sid < n_bits && read_map)
{
clib_bitmap_set_no_check (read_map, sid, 1);
@@ -1660,6 +1662,8 @@ vcl_select_handle_mq (vcl_worker_t * wrk, svm_msg_q_t * mq,
break;
}
session = vcl_ct_session_get_from_fifo (wrk, e->fifo, 0);
+ if (!session)
+ break;
sid = session->session_index;
if (sid < n_bits && read_map)
{
@@ -1669,9 +1673,9 @@ vcl_select_handle_mq (vcl_worker_t * wrk, svm_msg_q_t * mq,
break;
case SESSION_IO_EVT_CT_RX:
session = vcl_ct_session_get_from_fifo (wrk, e->fifo, 1);
- sid = session->session_index;
if (!session)
break;
+ sid = session->session_index;
if (sid < n_bits && write_map)
{
clib_bitmap_set_no_check (write_map, sid, 1);
@@ -2417,6 +2421,9 @@ vppcom_epoll_wait (uint32_t vep_handle, struct epoll_event *events,
}
vep_session = vcl_session_get_w_handle (wrk, vep_handle);
+ if (!vep_session)
+ return VPPCOM_EBADFD;
+
if (PREDICT_FALSE (!vep_session->is_vep))
{
clib_warning ("VCL<%d>: ERROR: vep_idx (%u) is not a vep!",
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index aa29090383a..d8531a467dd 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -1354,8 +1354,8 @@ 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);
+ if (!mp->is_add)
+ goto done;
/* Send fifo segment fd if needed */
if (ssvm_type (args.segment) == SSVM_SEGMENT_MEMFD)
@@ -1375,7 +1375,7 @@ vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp)
done:
REPLY_MACRO2 (VL_API_APP_WORKER_ADD_DEL_REPLY, ({
rmp->is_add = mp->is_add;
- if (!rv)
+ if (!rv && mp->is_add)
{
rmp->wrk_index = clib_host_to_net_u32 (args.wrk_index);
if (vec_len (args.segment->name))