diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c index 17c0c2dcd4..d262475a22 100644 --- a/subsys/net/ip/tcp.c +++ b/subsys/net/ip/tcp.c @@ -1404,8 +1404,8 @@ static void tcp_send_zwp(struct k_work *work) if (conn->send_win == 0) { uint64_t timeout = TCP_RTO_MS; - /* Make sure the retry counter does not overflow. */ - if (conn->zwp_retries < UINT8_MAX) { + /* Make sure the bitwise shift does not result in undefined behaviour */ + if (conn->zwp_retries < 63) { conn->zwp_retries++; }