From 28b70af8e5b4bea004138cfca74e79b44803c5db Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Tue, 13 Jun 2017 17:04:28 -0400 Subject: VPP-874: fix coverity warnings in tw_timer_template.c Best guess, tested carefully, should do no harm. Clang doesn't complain either way; it's not certain that this patch will make the coverity warnings in tw_timer_template.c disappear. Change-Id: I75aa0cfd8970751e823a1165df2a755e947c4cf9 Signed-off-by: Dave Barach --- src/vppinfra/tw_timer_template.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vppinfra/tw_timer_template.c b/src/vppinfra/tw_timer_template.c index a0c407ae..9253488c 100644 --- a/src/vppinfra/tw_timer_template.c +++ b/src/vppinfra/tw_timer_template.c @@ -132,13 +132,13 @@ TW (tw_timer_start) (TWT (tw_timer_wheel) * tw, u32 pool_index, u32 timer_id, #endif glacier_ring_offset = interval >> (2 * TW_RING_SHIFT); - ASSERT (glacier_ring_offset < TW_SLOTS_PER_RING); - interval -= (glacier_ring_offset << (2 * TW_RING_SHIFT)); + ASSERT ((u64) glacier_ring_offset < TW_SLOTS_PER_RING); + interval -= (((u64) glacier_ring_offset) << (2 * TW_RING_SHIFT)); #endif #if TW_TIMER_WHEELS > 1 slow_ring_offset = interval >> TW_RING_SHIFT; - ASSERT (slow_ring_offset < TW_SLOTS_PER_RING); - interval -= (slow_ring_offset << TW_RING_SHIFT); + ASSERT ((u64) slow_ring_offset < TW_SLOTS_PER_RING); + interval -= (((u64) slow_ring_offset) << TW_RING_SHIFT); #endif fast_ring_offset = interval & TW_RING_MASK; -- cgit 1.2.3-korg