Skip to content

Commit

Permalink
Fix various 'Uninitialized scalar variable' warnings from Coverity
Browse files Browse the repository at this point in the history
These are all not actually problems, since the
uninitialized parts are either .unused members of the
struct (mroute_addr) or only written to (buflen), but
still doesn't hurt to explicitely initialize them.

Change-Id: I45cd0917d24570ae9e9db7eb6c370756e4595842
Signed-off-by: Frank Lichtenheld <[email protected]>
Acked-by: Arne Schwabe <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg27157.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
flichtenheld authored and cron2 committed Jan 17, 2024
1 parent 4bcb38c commit 327355f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/openvpn/mudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ struct multi_instance *
multi_get_create_instance_udp(struct multi_context *m, bool *floated)
{
struct gc_arena gc = gc_new();
struct mroute_addr real;
struct mroute_addr real = {0};
struct multi_instance *mi = NULL;
struct hash *hash = m->hash;

Expand Down
8 changes: 4 additions & 4 deletions src/openvpn/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ multi_learn_in_addr_t(struct multi_context *m,
bool primary)
{
struct openvpn_sockaddr remote_si;
struct mroute_addr addr;
struct mroute_addr addr = {0};

CLEAR(remote_si);
remote_si.addr.in4.sin_family = AF_INET;
Expand Down Expand Up @@ -1273,7 +1273,7 @@ multi_learn_in6_addr(struct multi_context *m,
int netbits, /* -1 if host route, otherwise # of network bits in address */
bool primary)
{
struct mroute_addr addr;
struct mroute_addr addr = {0};

addr.len = 16;
addr.type = MR_ADDR_IPV6;
Expand Down Expand Up @@ -3137,7 +3137,7 @@ multi_process_post(struct multi_context *m, struct multi_instance *mi, const uns
void
multi_process_float(struct multi_context *m, struct multi_instance *mi)
{
struct mroute_addr real;
struct mroute_addr real = {0};
struct hash *hash = m->hash;
struct gc_arena gc = gc_new();

Expand Down Expand Up @@ -3551,7 +3551,7 @@ multi_process_incoming_tun(struct multi_context *m, const unsigned int mpp_flags
if (BLEN(&m->top.c2.buf) > 0)
{
unsigned int mroute_flags;
struct mroute_addr src, dest;
struct mroute_addr src = {0}, dest = {0};
const int dev_type = TUNNEL_TYPE(m->top.c1.tuntap);
int16_t vid = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/openvpn/pkcs11_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ xkey_pkcs11h_sign(void *handle, unsigned char *sig,
CK_RSA_PKCS_PSS_PARAMS pss_params = {0};

unsigned char buf[EVP_MAX_MD_SIZE];
size_t buflen;
size_t buflen = 0;
size_t siglen_max = *siglen;

unsigned char enc[EVP_MAX_MD_SIZE + 32]; /* 32 bytes enough for DigestInfo header */
Expand Down
2 changes: 1 addition & 1 deletion src/openvpn/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -3298,7 +3298,7 @@ link_socket_read_udp_posix_recvmsg(struct link_socket *sock,
{
struct iovec iov;
uint8_t pktinfo_buf[PKTINFO_BUF_SIZE];
struct msghdr mesg;
struct msghdr mesg = {0};
socklen_t fromlen = sizeof(from->dest.addr);

ASSERT(sock->sd >= 0); /* can't happen */
Expand Down

0 comments on commit 327355f

Please sign in to comment.