net: tcp: Make sure we shift by less then bit width
Shifting "timeout <<= conn->zwp_retries" by more then 63 bits results in undefined behaviour. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
42b121ee95
commit
303a0af68f
|
@ -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++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue