aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vcom.c
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2018-01-18 17:21:19 -0500
committerDave Wallace <dwallacelf@gmail.com>2018-01-18 17:21:19 -0500
commit8aaba56363f0cdf638f89c04f5110c24c5db1f3f (patch)
treeb3fab263dae32291ad5f36bb4be39c57c6821b19 /src/vcl/vcom.c
parentc58408c0f2db122c5185413ef35fe330551afc2d (diff)
LD_PRELOAD: Fix coverity warnings
** CID 182185: Memory - illegal accesses (UNINIT) ** CID 182184: Memory - illegal accesses (UNINIT) ** CID 182183: (UNINIT) ** CID 182182: Memory - illegal accesses (UNINIT) ** CID 182181: Memory - illegal accesses (UNINIT) ** CID 182180: Uninitialized variables (UNINIT) ** CID 182179: Null pointer dereferences (REVERSE_INULL) ** CID 182178: Uninitialized variables (UNINIT) ** CID 182177: Uninitialized variables (UNINIT) Change-Id: I33e043572db493eef58d85c5096ceac5a7d41c7a Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vcl/vcom.c')
-rw-r--r--src/vcl/vcom.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/vcl/vcom.c b/src/vcl/vcom.c
index 7c163112ba1..7558e775ed1 100644
--- a/src/vcl/vcom.c
+++ b/src/vcl/vcom.c
@@ -371,7 +371,7 @@ readv (int fd, const struct iovec * iov, int iovcnt)
const char *func_str;
ssize_t size = 0;
u32 sid = vcom_sid_from_fd (fd);
- int rv, i, total = 0;
+ int rv = 0, i, total = 0;
if ((errno = -vcom_init ()))
return -1;
@@ -508,7 +508,7 @@ writev (int fd, const struct iovec * iov, int iovcnt)
const char *func_str;
ssize_t size = 0, total = 0;
u32 sid = vcom_sid_from_fd (fd);
- int rv, i;
+ int i, rv = 0;
/*
* Use [f]printf() instead of clib_warning() to prevent recursion SIGSEGV.
@@ -1219,6 +1219,8 @@ socketpair (int domain, int type, int protocol, int fds[2])
if (((domain == AF_INET) || (domain == AF_INET6)) &&
((sock_type == SOCK_STREAM) || (sock_type == SOCK_DGRAM)))
{
+ func_str = __func__;
+
clib_warning ("LDP<%d>: LDP-TBD", getpid ());
errno = ENOSYS;
rv = -1;
@@ -2175,6 +2177,8 @@ sendmsg (int fd, const struct msghdr * message, int flags)
if (sid != INVALID_SESSION_ID)
{
+ func_str = __func__;
+
clib_warning ("LDP<%d>: LDP-TBD", getpid ());
errno = ENOSYS;
size = -1;
@@ -2269,6 +2273,8 @@ recvmsg (int fd, struct msghdr * message, int flags)
if (sid != INVALID_SESSION_ID)
{
+ func_str = __func__;
+
clib_warning ("LDP<%d>: LDP-TBD", getpid ());
errno = ENOSYS;
size = -1;
@@ -2360,7 +2366,7 @@ getsockopt (int fd, int level, int optname,
int rv;
const char *func_str = __func__;
u32 sid = vcom_sid_from_fd (fd);
- u32 buflen = (u32) * optlen;
+ u32 buflen = optlen ? (u32) * optlen : 0;
if ((errno = -vcom_init ()))
return -1;
@@ -2818,6 +2824,7 @@ vcom_accept4 (int listen_fd, __SOCKADDR_ARG addr,
{
vppcom_endpt_t ep;
u8 src_addr[sizeof (struct sockaddr_in6)];
+ memset (&ep, 0, sizeof (ep));
ep.ip = src_addr;
func_str = "vppcom_session_accept";
@@ -2917,6 +2924,8 @@ shutdown (int fd, int how)
if (sid != INVALID_SESSION_ID)
{
+ func_str = __func__;
+
clib_warning ("LDP<%d>: LDP-TBD", getpid ());
errno = ENOSYS;
rv = -1;
@@ -3107,7 +3116,7 @@ vcom_epoll_pwait (int epfd, struct epoll_event *events,
int maxevents, int timeout, const sigset_t * sigmask)
{
const char *func_str;
- int rv;
+ int rv = 0;
double time_to_wait = (double) 0;
double time_out, now = 0;
u32 vep_idx = vcom_sid_from_fd (epfd);