From: "cron2 (Code Review)" Date: Tue, 7 Oct 2025 07:37:07 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="MikZy3g7CSc="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dhcp: Fix conversion warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --MikZy3g7CSc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#4) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1241?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: dhcp: Fix conversion warnings ...................................................................... dhcp: Fix conversion warnings - Use correct type for pointer difference - Make sure that small sizeof sum is treated as int Change-Id: Ie0c0fbf4f7f8b379d46b6755c4eff209acc20fef Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1241 Message-Id: <20251006210127.28679-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59243110/ Signed-off-by: Gert Doering --- M src/openvpn/dhcp.c 1 file changed, 2 insertions(+), 11 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1241/4 diff --git a/src/openvpn/dhcp.c b/src/openvpn/dhcp.c index 38e8d40..850a4b6 100644 --- a/src/openvpn/dhcp.c +++ b/src/openvpn/dhcp.c @@ -72,11 +72,6 @@ return -1; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static in_addr_t do_extract(struct dhcp *dhcp, int optlen) { @@ -115,7 +110,7 @@ const int owlen =3D len + 2; /* len of data to ove= rwrite */ uint8_t *src =3D dest + owlen; uint8_t *end =3D p + optlen; - const int movlen =3D end - src; + const intptr_t movlen =3D end - src; if (movlen > 0) { memmove(dest, src, movlen); /* overwrite= router option */ @@ -155,7 +150,7 @@ struct dhcp_full *df =3D (struct dhcp_full *)BPTR(ipbuf); const int optlen =3D BLEN(ipbuf) - - (sizeof(struct openvpn_iphdr) + sizeof(struct openvpn_udphdr) + = sizeof(struct dhcp)); + - (int)(sizeof(struct openvpn_iphdr) + sizeof(struct openvpn_udphd= r) + sizeof(struct dhcp)); if (optlen >=3D 0 && df->ip.protocol =3D=3D OPENVPN_IPPROTO_UDP && df->udp.source =3D=3D htons(BOOTPS_PORT) && df->udp.dest =3D=3D= htons(BOOTPC_PORT) @@ -190,7 +185,3 @@ } return 0; } - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1241?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie0c0fbf4f7f8b379d46b6755c4eff209acc20fef Gerrit-Change-Number: 1241 Gerrit-PatchSet: 4 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --MikZy3g7CSc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #4 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by cron2

dhcp: Fix conversion warnings
- Use correct type for pointer difference
- Make sure that small sizeo= f sum is treated as int

Change-Id: Ie0c0fbf4f7f8b379d46b6755c4eff209= acc20fef
Signed-off-by: Frank Lichtenheld <frank@...2641...>
Ac= ked-by: Gert Doering <gert@...1296...>
Gerrit URL: https://gerrit.= openvpn.net/c/openvpn/+/1241
Message-Id: <20251006210127.28679-1-gert= @...1296...>
URL: https://sourceforge.net/p/openvpn/mailman/message/5= 9243110/
Signed-off-by: Gert Doering <gert@...1296...>
---
M= src/openvpn/dhcp.c
1 file changed, 2 insertions(+), 11 deletions(-)
=
git pull ssh://gerrit.openvpn.net:29418/openvpn ref=
s/changes/41/1241/4
diff --git a/src/openvpn/dhcp.c b/src/openvpn/d=
hcp.c
index 38e8d40..850a4b6 100644
--- a/s= rc/openvpn/dhcp.c
+++ b/src/openvpn/dhcp.c
= @@ -72,11 +72,6 @@
return -1;
}

-#if defin= ed(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"<= /span>
-#endif
-

static in_addr_t
do_extract(struct dhcp *dhcp, int optlen)
{=
@@ -115,7 +110,7 @@
= const int owlen =3D len + 2; /* len of data to overwrite */
uint8_t *src =3D dest + owlen;

uint8_t *end =3D p + optlen;

- const int movlen = =3D end - src;
+ = const intptr_t movlen =3D end - src;
= if (movlen > 0)
= {
memmove(dest, src, mo= vlen); /* overwrite router option */
@@ -155,7 +150,7= @@
struct dhcp_full *df =3D (struct dhcp_full *)BPTR(= ipbuf);
const int optlen =3D
= BLEN(ipbuf)
- - = (sizeof(struct openvpn_iphdr) + sizeof(struct openvpn_udphdr) + sizeof(stru= ct dhcp));
+ -= (int)(sizeof(struct openvpn_iphdr) + sizeof(struct openvpn_udphdr) + sizeo= f(struct dhcp));

if (optlen >=3D = 0 && df->ip.protocol =3D=3D OPENVPN_IPPROTO_UDP
= && df->udp.source =3D=3D htons(BOOTPS_PORT) && = df->udp.dest =3D=3D htons(BOOTPC_PORT)
@@ -190,7 +185,3 = @@
}
return 0;
}=
-
-#if defined(__GNUC__) || defined(__clang__= )
-#pragma GCC diagnost= ic pop
-#endif

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie0c0fbf4f7f8b379d46b6755c4e= ff209acc20fef
Gerrit-Change-Number: 1241
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --MikZy3g7CSc=--