From: "flichtenheld (Code Review)" Date: Thu, 25 Sep 2025 16:28:31 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <7eeacd2bd26dbf97391a6270379410b4d2c2a77c-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="hHqq5S72mzA="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dco_linux: Fix -Wconversion warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --hHqq5S72mzA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1220?usp=3Demail to review the following change. Change subject: dco_linux: Fix -Wconversion warnings ...................................................................... dco_linux: Fix -Wconversion warnings Combination of using the correct types and some unavoidable safe size_t->int casts. Change-Id: I473d345d10fc406f76fbdb131c28cc4fc54822fd Signed-off-by: Frank Lichtenheld --- M src/openvpn/dco_linux.c 1 file changed, 5 insertions(+), 14 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1220/1 diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 395a38f..d46fa46 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -62,11 +62,6 @@ typedef int (*ovpn_nl_cb)(struct nl_msg *msg, void *arg); -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /** * @brief resolves the netlink ID for ovpn-dco * @@ -110,7 +105,7 @@ } static struct nl_msg * -ovpn_dco_nlmsg_create(dco_context_t *dco, int cmd) +ovpn_dco_nlmsg_create(dco_context_t *dco, uint8_t cmd) { struct nl_msg *nl_msg =3D nlmsg_alloc(); if (!nl_msg) @@ -346,7 +341,7 @@ if (!(nlh->nlmsg_flags & NLM_F_CAPPED)) { - ack_len +=3D err->msg.nlmsg_len - sizeof(*nlh); + ack_len +=3D err->msg.nlmsg_len - (int)sizeof(*nlh); } if (len <=3D ack_len) @@ -360,8 +355,8 @@ nla_parse(tb_msg, OVPN_NLMSGERR_ATTR_MAX, attrs, len, NULL); if (tb_msg[NLMSGERR_ATTR_MSG]) { - len =3D strnlen((char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]), - nla_len(tb_msg[NLMSGERR_ATTR_MSG])); + len =3D (int)strnlen((char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]), + nla_len(tb_msg[NLMSGERR_ATTR_MSG])); msg(M_WARN, "kernel error: %*s", len, (char *)nla_data(tb_msg[NLMS= GERR_ATTR_MSG])); } @@ -606,7 +601,7 @@ msg(D_DCO_DEBUG, "%s: slot %d, key-id %d, peer-id %d, cipher %s", __fu= nc__, slot, keyid, peerid, ciphername); - const size_t key_len =3D cipher_kt_key_size(ciphername); + const int key_len =3D cipher_kt_key_size(ciphername); const int nonce_tail_len =3D 8; struct nl_msg *nl_msg =3D ovpn_dco_nlmsg_create(dco, OVPN_CMD_KEY_NEW); @@ -1303,8 +1298,4 @@ return "AES-128-GCM:AES-256-GCM:AES-192-GCM:CHACHA20-POLY1305"; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - #endif /* defined(ENABLE_DCO) && defined(TARGET_LINUX) */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1220?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: I473d345d10fc406f76fbdb131c28cc4fc54822fd Gerrit-Change-Number: 1220 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --hHqq5S72mzA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

dco_linux: Fix -Wconversion warnings

Combination of u= sing the correct types and some
unavoidable safe size_t->int casts.
Change-Id: I473d345d10fc406f76fbdb131c28cc4fc54822fd
Signed-off-by= : Frank Lichtenheld <frank@...2641...>
---
M src/openvpn/dco_li= nux.c
1 file changed, 5 insertions(+), 14 deletions(-)

git pul= l ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1220/1
dif=
f --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c
index 395a38f..d46fa46 100644
--- a/src/openvpn/dco_linux.= c
+++ b/src/openvpn/dco_linux.c
@@ -62,11 += 62,6 @@

typedef int (*ovpn_nl_cb)(struct= nl_msg *msg, void *arg);

-#if defined(__GNUC__) || defined(__clang__)-#pragma GCC diagnostic push
-#pragma GCC diagnostic ig= nored "-Wconversion"
-#endif
-

/**
* @brief resolves the netlink ID for ovpn= -dco
*
@@ -110,7 +105,7 @@
}

static struct nl_msg *
-ovpn_dco_nlmsg_create(dco_context_= t *dco, int cmd)
+ovp= n_dco_nlmsg_create(dco_context_t *dco, uint8_t cmd)
{

struct nl_msg *nl_msg =3D nlmsg_alloc();
= if (!nl_msg)
@@ -346,7 +341,7 @@

if (!(nlh->nlmsg_flags & NLM_F_CAPPED))
<= span> {

- ac= k_len +=3D err->msg.nlmsg_len - sizeof(*nlh);
+ ack_len +=3D err->msg.nlmsg_len - (= int)sizeof(*nlh);
}

= if (len <=3D ack_len)
@@ -360,8 +355,8 @@ nla_parse(tb_msg, OVPN_NLMSGERR_ATTR_MAX, attrs, len, NULL);
if (tb_msg[NLMSGERR_ATTR_MSG])
{
- len =3D strnlen(= (char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]),
- nla_len(tb_msg[NLMSGERR_ATTR_M= SG]));
+ len = =3D (int)strnlen((char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]),
+ nla_le= n(tb_msg[NLMSGERR_ATTR_MSG]));

msg(M_WARN, "k= ernel error: %*s", len, (char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]));<= /span>
}

@@ -606,7 +601,7 @= @
msg(D_DCO_DEBUG, "%s: slot %d, key-id %d, peer-= id %d, cipher %s", __func__, slot, keyid, peerid,
= ciphername);

- const size_t key_len =3D cipher_kt_key_size(ciphername);<= /span>
+ const int key_le= n =3D cipher_kt_key_size(ciphername);
const int nonce_= tail_len =3D 8;

struct nl_msg *nl_ms= g =3D ovpn_dco_nlmsg_create(dco, OVPN_CMD_KEY_NEW);
@@ -130= 3,8 +1298,4 @@
return "AES-128-GCM:AES-256-GCM:AE= S-192-GCM:CHACHA20-POLY1305";
}

-#if defined(__GNUC__) || = defined(__clang__)
-#pr= agma GCC diagnostic pop
-#endif
-
#endif /* defined(ENABLE_DCO) && defined(TARGET_LINUX) */

To view, visit change 1220. To unsubscribe, or = for help writing mail filters, visit settings.

<= /div>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I473d345d10fc406f76fbdb131c2= 8cc4fc54822fd
Gerrit-Change-Number: 1220
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-MessageType: newchange
--hHqq5S72mzA=--