aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2026-03-04 17:32:03 +0100
committerStefano Brivio <sbrivio@redhat.com>2026-03-06 08:24:01 +0100
commitab77097d264b61c7c8937163435001ba90a431c8 (patch)
treede86e376bba64ad85d66036b58112ef062b4231c
parent5766fe8af87da5a285a5e5d267e376bebf94ab0a (diff)
downloadpasst-ab77097d264b61c7c8937163435001ba90a431c8.tar
passt-ab77097d264b61c7c8937163435001ba90a431c8.tar.gz
passt-ab77097d264b61c7c8937163435001ba90a431c8.tar.bz2
passt-ab77097d264b61c7c8937163435001ba90a431c8.tar.lz
passt-ab77097d264b61c7c8937163435001ba90a431c8.tar.xz
passt-ab77097d264b61c7c8937163435001ba90a431c8.tar.zst
passt-ab77097d264b61c7c8937163435001ba90a431c8.zip
tcp: Avoid comparison of expressions with different signedness in tcp_timer_handler()
With gcc 14.2, building against musl 1.2.5 (slightly outdated Alpine on x86_64): tcp.c: In function 'tcp_timer_handler': util.h:40:39: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare] 40 | #define MIN(x, y) (((x) < (y)) ? (x) : (y)) | ^ tcp.c:2593:31: note: in expansion of macro 'MIN' 2593 | max = MIN(TCP_MAX_RETRIES, max); | ^~~ util.h:40:54: warning: operand of '?:' changes signedness from 'int' to 'unsigned int' due to unsignedness of other operand [-Wsign-compare] 40 | #define MIN(x, y) (((x) < (y)) ? (x) : (y)) | ^~~ tcp.c:2593:31: note: in expansion of macro 'MIN' 2593 | max = MIN(TCP_MAX_RETRIES, max); | ^~~ for some reason, that's not reported by gcc with glibc. Make the temporary 'max' variable unsigned, as we know it can't be negative anyway. While at it, add the customary blank line between variable declarations and code. Fixes: 3dde0e07804e ("tcp: Update data retransmission timeout") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--tcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index a0d7cd8..5808e6b 100644
--- a/tcp.c
+++ b/tcp.c
@@ -2588,7 +2588,8 @@ void tcp_timer_handler(const struct ctx *c, union epoll_ref ref)
tcp_timer_ctl(c, conn);
} else if (conn->flags & ACK_FROM_TAP_DUE) {
if (!(conn->events & ESTABLISHED)) {
- int max;
+ unsigned int max;
+
max = c->tcp.syn_retries + c->tcp.syn_linear_timeouts;
max = MIN(TCP_MAX_RETRIES, max);
if (conn->retries >= max) {