From: "flichtenheld (Code Review)" Date: Wed, 21 Jan 2026 17:16:06 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="CTtD45hvz9M="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: status: Avoid conversion warnings in status_read List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --CTtD45hvz9M= 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/+/1485?usp=3Demail to review the following change. Change subject: status: Avoid conversion warnings in status_read ...................................................................... status: Avoid conversion warnings in status_read Just use explicit casts. len is limited by BCAP and c is limited by being from buf_read_u8. So they are safe. Change-Id: Iff1343a2f8cc7e32b8f36b359a00248e4dc3e8c9 Signed-off-by: Frank Lichtenheld --- M src/openvpn/status.c 1 file changed, 3 insertions(+), 14 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/85/1485/1 diff --git a/src/openvpn/status.c b/src/openvpn/status.c index 3f57244..9a1b2fa 100644 --- a/src/openvpn/status.c +++ b/src/openvpn/status.c @@ -206,11 +206,6 @@ return ret; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - #define STATUS_PRINTF_MAXLEN 512 void @@ -274,16 +269,14 @@ /* read more of file into buffer */ if (c =3D=3D -1) { - int len; - ASSERT(buf_init(&so->read_buf, 0)); - len =3D read(so->fd, BPTR(&so->read_buf), BCAP(&so->read_b= uf)); + ssize_t len =3D read(so->fd, BPTR(&so->read_buf), BCAP(&so= ->read_buf)); if (len <=3D 0) { break; } - ASSERT(buf_inc_len(&so->read_buf, len)); + ASSERT(buf_inc_len(&so->read_buf, (int)len)); continue; } @@ -299,7 +292,7 @@ break; } - buf_write_u8(buf, c); + buf_write_u8(buf, (uint8_t)c); } buf_null_terminate(buf); @@ -307,7 +300,3 @@ return ret; } - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1485?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Iff1343a2f8cc7e32b8f36b359a00248e4dc3e8c9 Gerrit-Change-Number: 1485 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --CTtD45hvz9M= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

status: Avoid conversion warnings in status=
_read

Just use explicit casts. len is limited by BCAP and
c is li= mited by being from buf_read_u8. So they are
safe.

Change-Id: Iff= 1343a2f8cc7e32b8f36b359a00248e4dc3e8c9
Signed-off-by: Frank Lichtenheld = <frank@...2641...>
---
M src/openvpn/status.c
1 file changed= , 3 insertions(+), 14 deletions(-)

git pull ssh:=
//gerrit.openvpn.net:29418/openvpn refs/changes/85/1485/1
diff --=
git a/src/openvpn/status.c b/src/openvpn/status.c
index 3f5= 7244..9a1b2fa 100644
--- a/src/openvpn/status.c
<= span>+++ b/src/openvpn/status.c
@@ -206,11 +206,6 @@=
return ret;
}

<= span style=3D"color: hsl(0, 100%, 40%);">-#if defined(__GNUC__) || defined(= __clang__)
-#pragma GCC= diagnostic push
-#prag= ma GCC diagnostic ignored "-Wconversion"
-#endif
-
#define STATUS_PRINTF_MAXLEN 512
=
void
@@ -274,16 +269,14 @@<= br> /* read more of file into buffer */
= if (c =3D=3D -1)
{
- int len;
-
= ASSERT(buf_init(&so->read_buf, 0));
- len =3D read(so->fd, BPTR(&so-&= gt;read_buf), BCAP(&so->read_buf));
+ ssize_t len =3D read(so->fd, BPTR= (&so->read_buf), BCAP(&so->read_buf));
= if (len <=3D 0)
{
= break;
}=

- = ASSERT(buf_inc_len(&so->read_buf, len));
+ ASSERT(buf_inc_len(&s= o->read_buf, (int)len));
continue;
}

@@ -299,7 +292= ,7 @@
break;
= }

- = buf_write_u8(buf, c);
+ buf_write_u8(buf, (uint8_t)c);
= }

buf_null_terminate(buf);<= /span>
@@ -307,7 +300,3 @@

= return ret;
}
-
-#if defined(= __GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iff1343a2f8cc7e32b8f36b359a0= 0248e4dc3e8c9
Gerrit-Change-Number: 1485
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...>
= --CTtD45hvz9M=--