diff options
| author | Stefano Brivio <sbrivio@redhat.com> | 2026-03-06 08:02:35 +0100 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-03-10 15:25:05 +0100 |
| commit | 994bb76578645d181d315e4001d5fc0dfc92fcf6 (patch) | |
| tree | e115278d8fae67cb547aa4c7671fe7eec1d45bba /doc | |
| parent | ab77097d264b61c7c8937163435001ba90a431c8 (diff) | |
| download | passt-994bb76578645d181d315e4001d5fc0dfc92fcf6.tar passt-994bb76578645d181d315e4001d5fc0dfc92fcf6.tar.gz passt-994bb76578645d181d315e4001d5fc0dfc92fcf6.tar.bz2 passt-994bb76578645d181d315e4001d5fc0dfc92fcf6.tar.lz passt-994bb76578645d181d315e4001d5fc0dfc92fcf6.tar.xz passt-994bb76578645d181d315e4001d5fc0dfc92fcf6.tar.zst passt-994bb76578645d181d315e4001d5fc0dfc92fcf6.zip | |
tcp: Avoid comparison of expressions with different signedness in RTT_SET()
With gcc 14.2, building against musl 1.2.5 (slightly outdated Alpine
on x86_64):
tcp.c: In function 'tcp_update_seqack_wnd':
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_conn.h:63:26: note: in expansion of macro 'MIN'
63 | (conn->rtt_exp = MIN(RTT_EXP_MAX, ilog2(MAX(1, rtt / RTT_STORE_MIN))))
| ^~~
tcp.c:1234:17: note: in expansion of macro 'RTT_SET'
1234 | RTT_SET(conn, tinfo->tcpi_rtt);
| ^~~~~~~
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_conn.h:63:26: note: in expansion of macro 'MIN'
63 | (conn->rtt_exp = MIN(RTT_EXP_MAX, ilog2(MAX(1, rtt / RTT_STORE_MIN))))
| ^~~
tcp.c:1234:17: note: in expansion of macro 'RTT_SET'
1234 | RTT_SET(conn, tinfo->tcpi_rtt);
| ^~~~~~~
for some reason, that's not reported by gcc with glibc.
Cast the result of ilog2() to unsigned before using it, and introduce
0 as lower bound, to make it obvious that we expect the argument to be
always valid, the way we're using it.
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Fixes: 000601ba86da ("tcp: Adaptive interval based on RTT for socket-side acknowledgement checks")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'doc')
0 files changed, 0 insertions, 0 deletions
