From: "cron2 (Code Review)" Date: Wed, 17 Jan 2024 14:23:41 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <4df3be0a8822264ee47a1e423741860b4679517d-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="uIM5sFeG6l8="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix various 'Uninitialized scalar variable' warnings from Coverity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --uIM5sFeG6l8= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/31= 8?usp=3Demail ) Change subject: Fix various 'Uninitialized scalar variable' warnings from C= overity ...................................................................... Fix various 'Uninitialized scalar variable' warnings from Coverity 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 Acked-by: Arne Schwabe Message-Id: <20231008103641.19864-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27= 157.html Signed-off-by: Gert Doering --- M src/openvpn/mudp.c M src/openvpn/multi.c M src/openvpn/pkcs11_openssl.c M src/openvpn/socket.c 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 81625ea..e6c99ae 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -188,7 +188,7 @@ multi_get_create_instance_udp(struct multi_context *m, bool *floated) { struct gc_arena gc =3D gc_new(); - struct mroute_addr real; + struct mroute_addr real =3D {0}; struct multi_instance *mi =3D NULL; struct hash *hash =3D m->hash; diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index f4f0b8a..4344126 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -1234,7 +1234,7 @@ bool primary) { struct openvpn_sockaddr remote_si; - struct mroute_addr addr; + struct mroute_addr addr =3D {0}; CLEAR(remote_si); remote_si.addr.in4.sin_family =3D AF_INET; @@ -1273,7 +1273,7 @@ int netbits, /* -1 if host route, otherwise # of ne= twork bits in address */ bool primary) { - struct mroute_addr addr; + struct mroute_addr addr =3D {0}; addr.len =3D 16; addr.type =3D MR_ADDR_IPV6; @@ -3137,7 +3137,7 @@ void multi_process_float(struct multi_context *m, struct multi_instance *mi) { - struct mroute_addr real; + struct mroute_addr real =3D {0}; struct hash *hash =3D m->hash; struct gc_arena gc =3D gc_new(); @@ -3551,7 +3551,7 @@ if (BLEN(&m->top.c2.buf) > 0) { unsigned int mroute_flags; - struct mroute_addr src, dest; + struct mroute_addr src =3D {0}, dest =3D {0}; const int dev_type =3D TUNNEL_TYPE(m->top.c1.tuntap); int16_t vid =3D 0; diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c index aa0819f..1824c6b 100644 --- a/src/openvpn/pkcs11_openssl.c +++ b/src/openvpn/pkcs11_openssl.c @@ -166,7 +166,7 @@ CK_RSA_PKCS_PSS_PARAMS pss_params =3D {0}; unsigned char buf[EVP_MAX_MD_SIZE]; - size_t buflen; + size_t buflen =3D 0; size_t siglen_max =3D *siglen; unsigned char enc[EVP_MAX_MD_SIZE + 32]; /* 32 bytes enough for Digest= Info header */ diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 903f98b..480f4e5 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -3298,7 +3298,7 @@ { struct iovec iov; uint8_t pktinfo_buf[PKTINFO_BUF_SIZE]; - struct msghdr mesg; + struct msghdr mesg =3D {0}; socklen_t fromlen =3D sizeof(from->dest.addr); ASSERT(sock->sd >=3D 0); /* can't happen */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/318?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I45cd0917d24570ae9e9db7eb6c370756e4595842 Gerrit-Change-Number: 318 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --uIM5sFeG6l8= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Fix various 'Uninitialized scalar variable=
' warnings from Coverity

These are all not actually problems, si= nce 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: I45cd0917d24570ae9e9db7eb6c= 370756e4595842
Signed-off-by: Frank Lichtenheld <frank@...2641...>=
Acked-by: Arne Schwabe <arne-openvpn@...1227...>
Message-Id: &= lt;20231008103641.19864-1-frank@...2641...>
URL: https://www.mail-arc= hive.com/openvpn-devel@lists.sourceforge.net/msg27157.html
Signed-off-by= : Gert Doering <gert@...1296...>
---
M src/openvpn/mudp.c
M = src/openvpn/multi.c
M src/openvpn/pkcs11_openssl.c
M src/openvpn/sock= et.c
4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c
ind= ex 81625ea..e6c99ae 100644
--- a/src/openvpn/mudp.c<= br>+++ b/src/openvpn/mudp.c
@@ -188,7 +188,7 @@
multi_get_create_instance_udp(struct multi_context *m, bool *fl= oated)
{
struct gc_arena gc =3D gc_ne= w();
- struct mroute= _addr real;
+ stru= ct mroute_addr real =3D {0};
struct multi_instance *mi= =3D NULL;
struct hash *hash =3D m->hash;
diff --git a/src/openvpn/multi.c b/src/openvpn/mul= ti.c
index f4f0b8a..4344126 100644
--- a/sr= c/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -1234,7 +1234,7 @@

bool primary)=
{
struct openvpn_sockaddr remote_si;=
- struct mroute_add= r addr;
+ struct m= route_addr addr =3D {0};

CLEAR(remot= e_si);
remote_si.addr.in4.sin_family =3D AF_INET;
@@ -1273,7 +1273,7 @@
int= netbits, /* -1 if host route, otherwise # of network bits in address */<= /span>
bool primary)
{
- struct mroute_addr add= r;
+ struct mroute= _addr addr =3D {0};

addr.len =3D 16;=
addr.type =3D MR_ADDR_IPV6;
@@ -3137,= 7 +3137,7 @@
void
multi_process_float(str= uct multi_context *m, struct multi_instance *mi)
{<= br>- struct mroute_addr real;<= /span>
+ struct mroute_ad= dr real =3D {0};
struct hash *hash =3D m->hash;

struct gc_arena gc =3D gc_new();
=
@@ -3551,7 +3551,7 @@
if (BLEN(&m->to= p.c2.buf) > 0)
{
unsigned = int mroute_flags;
- = struct mroute_addr src, dest;
+ struct mroute_addr src =3D {0}, dest =3D {0};<= br> const int dev_type =3D TUNNEL_TYPE(m->top.c1.tuntap);<= /span>
int16_t vid =3D 0;

diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c=

index aa0819f..1824c6b 100644
--- a/src/op= envpn/pkcs11_openssl.c
+++ b/src/openvpn/pkcs11_openssl.c
@@ -166,7 +166,7 @@
CK_RSA_PKCS_PSS_PAR= AMS pss_params =3D {0};

unsigned cha= r buf[EVP_MAX_MD_SIZE];
- size_t buflen;
= + size_t buflen =3D 0;
size_t siglen_max =3D *sigle= n;

unsigned char enc[EVP_MAX_MD_SIZE= + 32]; /* 32 bytes enough for DigestInfo header */
diff --= git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 903= f98b..480f4e5 100644
--- a/src/openvpn/socket.c
<= span>+++ b/src/openvpn/socket.c

@@ -3298,7 +3298,7 @@
{
struct iovec iov;
u= int8_t pktinfo_buf[PKTINFO_BUF_SIZE];
- struct msghdr mesg;
+ struct msghdr mesg =3D {0};
so= cklen_t fromlen =3D sizeof(from->dest.addr);
ASSERT(sock->sd >=3D 0); /* can'= t happen */

To view, visit change 318. To un= subscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I45cd0917d24570ae9e9db7eb6c3= 70756e4595842
Gerrit-Change-Number: 318
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--uIM5sFeG6l8=--