tcp: coverity fixes 76/15676/2
authorFlorin Coras <fcoras@cisco.com>
Fri, 2 Nov 2018 15:23:58 +0000 (08:23 -0700)
committerFlorin Coras <fcoras@cisco.com>
Fri, 2 Nov 2018 15:26:24 +0000 (08:26 -0700)
Change-Id: Ib15d629c5fde7849bfa3307f42659e920eb0f463
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/vnet/tcp/tcp.c
src/vnet/tcp/tcp_input.c
src/vnet/tcp/tcp_output.c

index ba427b7..1fb95b3 100644 (file)
@@ -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
index fb2f1dd..21e5f3c 100644 (file)
@@ -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++)
index c135a31..78f7c3f 100644 (file)
@@ -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
     {