From 273968cf2d0343b2f4e3217f25c0752f20cf03c5 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Mon, 3 Jan 2022 10:34:52 -0800 Subject: tcp: cast timer ticks to u32 tc->rto * TCP_TO_TIMER_TICK can return garbage if not cast to u32 and that confuses clib_max Type: fix Signed-off-by: Florin Coras signed-off-by: Vipul Agrawal Change-Id: Ief4d29b9625e2ef2e75e0c7e3d731ab147465f6d --- src/vnet/tcp/tcp_timer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/vnet/tcp/tcp_timer.h') diff --git a/src/vnet/tcp/tcp_timer.h b/src/vnet/tcp/tcp_timer.h index 4668c79cabf..5f14a71ee7d 100644 --- a/src/vnet/tcp/tcp_timer.h +++ b/src/vnet/tcp/tcp_timer.h @@ -56,7 +56,7 @@ tcp_retransmit_timer_set (tcp_timer_wheel_t * tw, tcp_connection_t * tc) { ASSERT (tc->snd_una != tc->snd_nxt); tcp_timer_set (tw, tc, TCP_TIMER_RETRANSMIT, - clib_max (tc->rto * TCP_TO_TIMER_TICK, 1)); + clib_max ((u32) tc->rto * TCP_TO_TIMER_TICK, 1)); } always_inline void @@ -70,7 +70,7 @@ tcp_persist_timer_set (tcp_timer_wheel_t * tw, tcp_connection_t * tc) { /* Reuse RTO. It's backed off in handler */ tcp_timer_set (tw, tc, TCP_TIMER_PERSIST, - clib_max (tc->rto * TCP_TO_TIMER_TICK, 1)); + clib_max ((u32) tc->rto * TCP_TO_TIMER_TICK, 1)); } always_inline void @@ -81,7 +81,7 @@ tcp_persist_timer_update (tcp_timer_wheel_t * tw, tcp_connection_t * tc) if (seq_leq (tc->snd_una, tc->snd_congestion + tc->burst_acked)) interval = 1; else - interval = clib_max (tc->rto * TCP_TO_TIMER_TICK, 1); + interval = clib_max ((u32) tc->rto * TCP_TO_TIMER_TICK, 1); tcp_timer_update (tw, tc, TCP_TIMER_PERSIST, interval); } @@ -103,7 +103,7 @@ tcp_retransmit_timer_update (tcp_timer_wheel_t * tw, tcp_connection_t * tc) } else tcp_timer_update (tw, tc, TCP_TIMER_RETRANSMIT, - clib_max (tc->rto * TCP_TO_TIMER_TICK, 1)); + clib_max ((u32) tc->rto * TCP_TO_TIMER_TICK, 1)); } always_inline u8 -- cgit 1.2.3-korg