From 6176f9d6dfea925c8c72d46583929399977584da Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Tue, 6 Oct 2020 11:08:52 +0000 Subject: [PATCH] Remove dead stores reported by clang static code analysis MFC after: 3 days --- sys/netinet/sctp_input.c | 6 +----- sys/netinet/sctp_output.c | 4 ++-- sys/netinet/sctp_pcb.c | 2 +- sys/netinet/sctputil.c | 4 ---- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 83692ad49e6..b83f312a7ad 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -4116,7 +4116,6 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp, struct sctp_idata_chunk *idata_chunk; uint32_t bottle_bw, on_queue; uint32_t offset, chk_len; - uint16_t trunc_len; uint16_t pktdrp_len; uint8_t pktdrp_flags; @@ -4126,13 +4125,10 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp, pktdrp_len = ntohs(cp->ch.chunk_length); KASSERT(limit <= pktdrp_len, ("Inconsistent limit")); if (pktdrp_flags & SCTP_PACKET_TRUNCATED) { - trunc_len = ntohs(cp->trunc_len); - if (trunc_len <= pktdrp_len - sizeof(struct sctp_pktdrop_chunk)) { + if (ntohs(cp->trunc_len) <= pktdrp_len - sizeof(struct sctp_pktdrop_chunk)) { /* The peer plays games with us. */ return; } - } else { - trunc_len = 0; } limit -= sizeof(struct sctp_pktdrop_chunk); offset = 0; diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index e7dae090af2..7a2b0602250 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -8793,7 +8793,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, * the top of the for, but just to make sure * I will reset these again here. */ - ctl_cnt = bundle_at = 0; + ctl_cnt = 0; continue; /* This takes us back to the * for() for the nets. */ } else { @@ -9392,7 +9392,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, uint32_t dmtu = 0; SCTP_TCB_LOCK_ASSERT(stcb); - tmr_started = ctl_cnt = bundle_at = error = 0; + tmr_started = ctl_cnt = 0; no_fragmentflg = 1; fwd_tsn = 0; *cnt_out = 0; diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 2c5ad975f32..d58d7e56bfa 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4345,7 +4345,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, LIST_INSERT_HEAD(head, stcb, sctp_asocs); SCTP_INP_INFO_WUNLOCK(); - if ((err = sctp_add_remote_addr(stcb, firstaddr, NULL, port, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) { + if (sctp_add_remote_addr(stcb, firstaddr, NULL, port, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC)) { /* failure.. memory error? */ if (asoc->strmout) { SCTP_FREE(asoc->strmout, SCTP_M_STRMO); diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index ed09e48d0aa..7772ebd5732 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1725,7 +1725,6 @@ sctp_timeout_handler(void *t) net = (struct sctp_nets *)tmr->net; CURVNET_SET((struct vnet *)tmr->vnet); NET_EPOCH_ENTER(et); - did_output = 1; released_asoc_reference = false; #ifdef SCTP_AUDITING_ENABLED @@ -1994,7 +1993,6 @@ sctp_timeout_handler(void *t) op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Shutdown guard timer expired"); sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); - did_output = true; /* no need to unlock on tcb its gone */ goto out_decr; case SCTP_TIMER_TYPE_AUTOCLOSE: @@ -2071,7 +2069,6 @@ sctp_timeout_handler(void *t) #ifdef INVARIANTS panic("Unknown timer type %d", type); #else - did_output = false; goto out; #endif } @@ -2155,7 +2152,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, ("sctp_timer_start of type %d: inp = %p, stcb->sctp_ep %p", t_type, stcb, stcb->sctp_ep)); tmr = NULL; - to_ticks = 0; if (stcb != NULL) { SCTP_TCB_LOCK_ASSERT(stcb); } else if (inp != NULL) { -- 2.45.0