diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2017-10-26 16:12:04 -0400 |
---|---|---|
committer | Chris Luke <chris_luke@comcast.com> | 2017-10-26 21:25:26 +0000 |
commit | faf9d7730828b80814a233eeecf7affc046193d3 (patch) | |
tree | 8d2dbf8c03b9fc117ba4c42f897c43cda7997d64 /src/vcl/vppcom.c | |
parent | 617dffaee47fc6fbc0dca85dc07c53ca9b57bf90 (diff) |
VCL-LDPRELOAD: Fix more coverity warnings
vcom.c:
CID 178227: Logically dead code in vcom.c
vcom_socket.c:
CID 178254: Dereference after null check
CID 178250: Out-of-bounds access
vppcom.c:
CID 178252: Unused value
Suppress vppcom_session_attr() debug output.
Change-Id: I1d47bafb84fc0ad00c642392ae3cb6761fd3fb17
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r-- | src/vcl/vppcom.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 75e86c843cc..acfeb205e2d 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -3284,7 +3284,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, { case VPPCOM_ATTR_GET_NREAD: rv = vppcom_session_read_ready (session, session_index); - if (VPPCOM_DEBUG > 0) + if (VPPCOM_DEBUG > 1) clib_warning ("VPPCOM_ATTR_GET_NREAD: nread = %d", rv); break; @@ -3298,7 +3298,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, { *flags = O_RDWR | ((session->is_nonblocking) ? O_NONBLOCK : 0); *buflen = sizeof (*flags); - if (VPPCOM_DEBUG > 0) + if (VPPCOM_DEBUG > 1) clib_warning ("VPPCOM_ATTR_GET_FLAGS: flags = 0x%08x, " "is_nonblocking = %u", *flags, session->is_nonblocking); @@ -3311,7 +3311,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, if (buffer && buflen && (*buflen >= sizeof (*flags))) { session->is_nonblocking = (*flags & O_NONBLOCK) ? 1 : 0; - if (VPPCOM_DEBUG > 0) + if (VPPCOM_DEBUG > 1) clib_warning ("VPPCOM_ATTR_SET_FLAGS: flags = 0x%08x, " "is_nonblocking = %u", *flags, session->is_nonblocking); @@ -3333,7 +3333,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, clib_memcpy (ep->ip, &session->peer_addr.ip46.ip6, sizeof (ip6_address_t)); *buflen = sizeof (*ep); - if (VPPCOM_DEBUG > 0) + if (VPPCOM_DEBUG > 1) clib_warning ("VPPCOM_ATTR_GET_PEER_ADDR: sid %u is_ip4 = %u, " "addr = %U, port %u", session_index, ep->is_ip4, format_ip46_address, @@ -3357,7 +3357,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, clib_memcpy (ep->ip, &session->lcl_addr.ip46.ip6, sizeof (ip6_address_t)); *buflen = sizeof (*ep); - if (VPPCOM_DEBUG > 0) + if (VPPCOM_DEBUG > 1) clib_warning ("VPPCOM_ATTR_GET_LCL_ADDR: sid %u is_ip4 = %u, " "addr = %U port %d", session_index, ep->is_ip4, format_ip46_address, @@ -3414,7 +3414,9 @@ vppcom_session_recvfrom (uint32_t session_index, void *buffer, if (VPPCOM_DEBUG > 0) clib_warning ("[%d] invalid session, sid (%u) has been closed!", vcm->my_pid, session_index); - rv = VPPCOM_EINVAL; + rv = VPPCOM_EBADFD; + clib_spinlock_unlock (&vcm->sessions_lockp); + goto done; } ep->vrf = session->vrf; ep->is_ip4 = session->peer_addr.is_ip4; @@ -3438,6 +3440,7 @@ vppcom_session_recvfrom (uint32_t session_index, void *buffer, rv = VPPCOM_EAFNOSUPPORT; } +done: return rv; } |