summaryrefslogtreecommitdiffstats
path: root/src/vcl
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
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')
-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);
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __included_crc32_h__
#define __included_crc32_h__

#include <vppinfra/clib.h>

#if __SSE4_2__
#define clib_crc32c_uses_intrinsics
#include <x86intrin.h>

#define crc32_u64 _mm_crc32_u64
#define crc32_u32 _mm_crc32_u32

static_always_inline u32
clib_crc32c (u8 * s, int len)
{
  u32 v = 0;

#if defined(__x86_64__)
  for (; len >= 8; len -= 8, s += 8)
    v = _mm_crc32_u64 (v, *((u64 *) s));
#else
  /* workaround weird GCC bug when using _mm_crc32_u32
     which happens with -O2 optimization */
#if !defined (__i686__)
  asm volatile ("":::"memory");
#endif
#endif

  for (; len >= 4; len -= 4, s += 4)
    v = _mm_crc32_u32 (v, *((u32 *) s));

  for (; len >= 2; len -= 2, s += 2)
    v = _mm_crc32_u16 (v, *((u16 *) s));

  for (; len >= 1; len -= 1, s += 1)
    v = _mm_crc32_u8 (v, *((u16 *) s));

  return v;
}

#elif __ARM_FEATURE_CRC32
#define clib_crc32c_uses_intrinsics
#include <arm_acle.h>


#define crc32_u64 __crc32cd
#define crc32_u32 __crc32cw

static_always_inline u32
clib_crc32c (u8 * s, int len)
{
  u32 v = 0;

  for (; len >= 8; len -= 8, s += 8)
    v = __crc32cd (v, *((u64 *) s));

  for (; len >= 4; len -= 4, s += 4)
    v = __crc32cw (v, *((u32 *) s));

  for (; len >= 2; len -= 2, s += 2)
    v = __crc32ch (v, *((u16 *) s));

  for (; len >= 1; len -= 1, s += 1)
    v = __crc32cb (v, *((u8 *) s));

  return v;
}

#endif
#endif /* __included_crc32_h__ */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */