From: "cron2 (Code Review)" Date: Fri, 26 Sep 2025 20:39:10 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <4c411d354dafff6e18c9c74def8a1119fc626e5d-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="0ONS/Po/PRc="; 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: flichtenheld Cc: plaisthos , openvpn-devel --0ONS/Po/PRc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/12= 20?usp=3Demail ) 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 Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1220 Message-Id: <20250926142442.20796-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59239172/ Signed-off-by: Gert Doering --- M src/openvpn/dco_linux.c 1 file changed, 5 insertions(+), 14 deletions(-) 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: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --0ONS/Po/PRc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

dco_linux: Fix -Wconversion warnings

C= ombination of using the correct types and some
unavoidable safe size_t-&= gt;int casts.

Change-Id: I473d345d10fc406f76fbdb131c28cc4fc54822fdSigned-off-by: Frank Lichtenheld <frank@...2641...>
Acked-by: An= tonio Quartulli <antonio@...2726...>
Gerrit URL: https://gerrit.op= envpn.net/c/openvpn/+/1220
Message-Id: <20250926142442.20796-1-gert@...220...= ..1296...>
URL: https://sourceforge.net/p/openvpn/mailman/message/592= 39172/
Signed-off-by: Gert Doering <gert@...1296...>
---
M s= rc/openvpn/dco_linux.c
1 file changed, 5 insertions(+), 14 deletions(-)<= br>
diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.cindex 395a38f..d46fa46 100644
--- a/src/openvpn/dco_= linux.c
+++ b/src/openvpn/dco_linux.c
@@ -6= 2,11 +62,6 @@

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

-#if defined(__GNUC__) || defined(__clang__)

-#pragma GCC diagnostic pu= sh
-#pragma GCC diagnos= tic ignored "-Wconversion"
-#endif
-=
/**
* @brief resolves the netlink ID fo= r ovpn-dco
*
@@ -110,7 +105,7 @@ }

static struct nl_msg *=
-ovpn_dco_nlmsg_create(dco_co= ntext_t *dco, int cmd)
- = ack_len +=3D err->msg.nlmsg_len - sizeof(*nlh);
+ ack_len +=3D err->msg.nlmsg_l= en - (int)sizeof(*nlh);
}

= if (len <=3D ack_len)
@@ -360,8 +355,8 @@
nla_parse(tb_msg, OVPN_NLMSGERR_ATTR_MAX, attrs, len, NUL= L);
if (tb_msg[NLMSGERR_ATTR_MSG])
= {
- len =3D st= rnlen((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]),+ n= la_len(tb_msg[NLMSGERR_ATTR_MSG]));
msg(M_WARN, &q= uot;kernel error: %*s", len, (char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG= ]));
}

@@ -606,7 +60= 1,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(cipherna= me);
+ const int k= ey_len =3D cipher_kt_key_size(ciphername);
const int n= once_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-G= CM:AES-192-GCM:CHACHA20-POLY1305";
}
=
-#if defined(__GNUC__= ) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-<= br> #endif /* defined(ENABLE_DCO) && defined(TARGET_LINUX) */=

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I473d345d10fc406f76fbdb131c2= 8cc4fc54822fd
Gerrit-Change-Number: 1220
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--0ONS/Po/PRc=--