From: "cron2 (Code Review)" Date: Thu, 12 Mar 2026 07:38:44 +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="rb7CAXYmrPA="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: socket: Avoid sign-compare issue by comparing before assignment List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --rb7CAXYmrPA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#5) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1523?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: socket: Avoid sign-compare issue by comparing before assign= ment ...................................................................... socket: Avoid sign-compare issue by comparing before assignment The assignment implicitly converts the values, but we can just do the comparison before the assignment. Change-Id: Idf5ce8f82e7727505cce67560e0b7423b8e41a40 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1523 Message-Id: <20260306163202.2586-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 961.html Signed-off-by: Gert Doering --- M src/openvpn/socket.c 1 file changed, 2 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/23/1523/5 diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 8d2d110..5df0792 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -2550,11 +2550,6 @@ return WSAGetLastError(); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif - int socket_recv_queue(struct link_socket *sock, int maxsize) { @@ -2579,11 +2574,10 @@ /* Win32 docs say it's okay to allocate the wsabuf on the stack */ wsabuf[0].buf =3D BSTR(&sock->reads.buf); + /* make sure maxsize is sane */ + ASSERT(maxsize <=3D BLEN(&sock->reads.buf)); wsabuf[0].len =3D maxsize ? maxsize : BLEN(&sock->reads.buf); - /* check for buffer overflow */ - ASSERT(wsabuf[0].len <=3D BLEN(&sock->reads.buf)); - /* the overlapped read will signal this event on I/O completion */ ASSERT(ResetEvent(sock->reads.overlapped.hEvent)); sock->reads.flags =3D 0; @@ -2656,10 +2650,6 @@ return sock->reads.iostate; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - int socket_send_queue(struct link_socket *sock, struct buffer *buf, const stru= ct link_socket_actual *to) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1523?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: Idf5ce8f82e7727505cce67560e0b7423b8e41a40 Gerrit-Change-Number: 1523 Gerrit-PatchSet: 5 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --rb7CAXYmrPA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

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

View Change

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

socket: Avoid sign-compare issue by=
 comparing before assignment

The assignment implicitly converts the = values, but
we can just do the comparison before the assignment.

= Change-Id: Idf5ce8f82e7727505cce67560e0b7423b8e41a40
Signed-off-by: Fran= k Lichtenheld <frank@...2641...>
Acked-by: Gert Doering <gert@...220...= ..1296...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1523Message-Id: <20260306163202.2586-1-gert@...1296...>
URL: https://= www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35961.html
S= igned-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/= socket.c
1 file changed, 2 insertions(+), 12 deletions(-)

<= pre class=3D"blocks" style=3D"font-family: monospace,monospace; white-space= : pre-wrap;">git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/2= 3/1523/5
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 8d2d110..5df0792 100644
--- a/src/open= vpn/socket.c
+++ b/src/openvpn/socket.c
@@ = -2550,11 +2550,6 @@
return WSAGetLastError(); }

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Ws= ign-compare"
-#end= if
-
i= nt
socket_recv_queue(struct link_socket *sock, int maxsize= )
{
@@ -2579,11 +2574,10 @@

/* Win32 docs say it's okay to allocate th= e wsabuf on the stack */
wsabuf[0].buf =3D BSTR(&a= mp;sock->reads.buf);
+ /* make sure maxsize is sane */
+ ASSERT(maxsize <=3D BLEN(&sock->r= eads.buf));
wsabuf[0].len =3D maxsize ? maxsize : = BLEN(&sock->reads.buf);

- /* check for buffer overflow */- ASSERT(wsabuf[0].len &= lt;=3D BLEN(&sock->reads.buf));
-
/* the overlapped read will sign= al this event on I/O completion */
ASSERT(ResetEve= nt(sock->reads.overlapped.hEvent));
sock->re= ads.flags =3D 0;
@@ -2656,10 +2650,6 @@
= return sock->reads.iostate;
}

-#if defined(__GNUC__) || de= fined(__clang__)
-#prag= ma GCC diagnostic pop
-= #endif
-
int

socket_send_queue(struct link_socket *sock, struct = buffer *buf, const struct link_socket_actual *to)
{=

To view, visit change 1523. To unsubscribe, or fo= r help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Idf5ce8f82e7727505cce67560e0= b7423b8e41a40
Gerrit-Change-Number: 1523
Gerrit-PatchSet: 5
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>
= --rb7CAXYmrPA=--