From 776f3d85ebd4edfb70b0f748890f1efd98d8474c Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 2 Nov 2018 08:23:58 -0700 Subject: [PATCH] tcp: coverity fixes Change-Id: Ib15d629c5fde7849bfa3307f42659e920eb0f463 Signed-off-by: Florin Coras --- src/vnet/tcp/tcp.c | 14 +++++++------- src/vnet/tcp/tcp_input.c | 2 +- src/vnet/tcp/tcp_output.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index ba427b76b1a..1fb95b3ad3a 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -1798,6 +1798,12 @@ tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose) tcp_connection_t _dummy_tc, *dummy_tc = &_dummy_tc; sack_block_t *block; + if (!TCP_SCOREBOARD_TRACE) + { + s = format (s, "scoreboard tracing not enabled"); + return s; + } + if (!tc) return s; @@ -1806,13 +1812,7 @@ tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose) scoreboard_init (&dummy_tc->sack_sb); dummy_tc->rcv_opts.flags |= TCP_OPTS_FLAG_SACK; -/* Since this is also accessible via decl. in tcp.h. - * Otherwise, it is gated earlier by cli parser. - */ -#if (!TCP_SCOREBOARD_TRACE) - s = format (0, "scoreboard tracing not enabled"); - return s; -#else +#if TCP_SCOREBOARD_TRACE trace = tc->sack_sb.trace; trace_len = vec_len (tc->sack_sb.trace); #endif diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index fb2f1ddc9ef..21e5f3cdaba 100644 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -1213,7 +1213,7 @@ tcp_do_fastretransmits (tcp_worker_ctx_t * wrk) _vec_len (wrk->postponed_fast_rxt) = 0; _vec_len (wrk->pending_fast_rxt) = 0; - max_burst_size = VLIB_FRAME_SIZE / vec_len (wrk->ongoing_fast_rxt); + max_burst_size = VLIB_FRAME_SIZE / vec_len (ongoing_fast_rxt); max_burst_size = clib_max (max_burst_size, 1); for (i = 0; i < vec_len (ongoing_fast_rxt); i++) diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index c135a311fb5..78f7c3f8294 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -862,7 +862,7 @@ tcp_send_reset_w_pkt (tcp_connection_t * tc, vlib_buffer_t * pkt, u8 is_ip4) { flags = TCP_FLAG_RST; seq = pkt_th->ack_number; - ack = (tc && tc->state >= TCP_STATE_SYN_RCVD) ? tc->rcv_nxt : 0; + ack = (tc->state >= TCP_STATE_SYN_RCVD) ? tc->rcv_nxt : 0; } else { -- 2.16.6