Date: Wed, 8 Sep 2021 13:19:11 GMT From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: aab1d593b2ec - main - sctp: minor cleanups, no functional change intended Message-ID: <202109081319.188DJBKk006504@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=aab1d593b2ec2c24a808eed39c39890b066d5fba commit aab1d593b2ec2c24a808eed39c39890b066d5fba Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2021-09-08 13:13:05 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2021-09-08 13:13:49 +0000 sctp: minor cleanups, no functional change intended --- sys/netinet/sctp_input.c | 4 ++-- sys/netinet/sctp_output.c | 6 +++--- sys/netinet/sctp_pcb.c | 2 +- sys/netinet/sctp_timer.c | 12 ++++++------ sys/netinet/sctp_usrreq.c | 6 +++--- sys/netinet/sctputil.c | 16 ++++++++-------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 77d15dcc955b..34f30799ec79 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2444,10 +2444,10 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, if ((uint32_t)diff.tv_sec > UINT32_MAX / 1000000) { staleness = UINT32_MAX; } else { - staleness = diff.tv_sec * 1000000; + staleness = (uint32_t)diff.tv_sec * 1000000; } if (UINT32_MAX - staleness >= (uint32_t)diff.tv_usec) { - staleness += diff.tv_usec; + staleness += (uint32_t)diff.tv_usec; } else { staleness = UINT32_MAX; } diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 142c5dbf33b6..24c6879e1925 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -11328,7 +11328,7 @@ sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked) /* Fill out hb parameter */ hb->heartbeat.hb_info.ph.param_type = htons(SCTP_HEARTBEAT_INFO); hb->heartbeat.hb_info.ph.param_length = htons(sizeof(struct sctp_heartbeat_info_param)); - hb->heartbeat.hb_info.time_value_1 = now.tv_sec; + hb->heartbeat.hb_info.time_value_1 = (uint32_t)now.tv_sec; hb->heartbeat.hb_info.time_value_2 = now.tv_usec; /* Did our user request this one, put it in */ hb->heartbeat.hb_info.addr_family = (uint8_t)net->ro._l_addr.sa.sa_family; @@ -12847,7 +12847,7 @@ sctp_lower_sosend(struct socket *so, SCTP_TCB_UNLOCK(stcb); hold_tcblock = 0; } else { - atomic_add_int(&stcb->asoc.sb_send_resv, sndlen); + atomic_add_int(&stcb->asoc.sb_send_resv, (int)sndlen); } local_soresv = sndlen; if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { @@ -13684,7 +13684,7 @@ out: out_unlocked: if (local_soresv && stcb) { - atomic_subtract_int(&stcb->asoc.sb_send_resv, sndlen); + atomic_subtract_int(&stcb->asoc.sb_send_resv, (int)sndlen); } if (create_lock_applied) { SCTP_ASOC_CREATE_UNLOCK(inp); diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 85ea5a3f8a53..473c71917ce7 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2576,7 +2576,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) /* Setup the initial secret */ (void)SCTP_GETTIME_TIMEVAL(&time); - m->time_of_secret_change = time.tv_sec; + m->time_of_secret_change = (unsigned int)time.tv_sec; for (i = 0; i < SCTP_NUMBER_OF_SECRETS; i++) { m->secret_key[0][i] = sctp_select_initial_TSN(m); diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 2d3836829e89..4866356bdf5c 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -542,8 +542,8 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb, min_wait.tv_sec = min_wait.tv_usec = 0; } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { - sctp_log_fr(cur_rto, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME); - sctp_log_fr(0, min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME); + sctp_log_fr(cur_rto, (uint32_t)now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME); + sctp_log_fr(0, (uint32_t)min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME); } /* * Our rwnd will be incorrect here since we are not adding back the @@ -590,7 +590,7 @@ start_again: /* validate its been outstanding long enough */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(chk->rec.data.tsn, - chk->sent_rcv_time.tv_sec, + (uint32_t)chk->sent_rcv_time.tv_sec, chk->sent_rcv_time.tv_usec, SCTP_FR_T3_MARK_TIME); } @@ -602,7 +602,7 @@ start_again: */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(0, - chk->sent_rcv_time.tv_sec, + (uint32_t)chk->sent_rcv_time.tv_sec, chk->sent_rcv_time.tv_usec, SCTP_FR_T3_STOPPED); } @@ -853,11 +853,11 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, if (net != stcb->asoc.primary_destination) { /* send a immediate HB if our RTO is stale */ struct timeval now; - unsigned int ms_goneby; + uint32_t ms_goneby; (void)SCTP_GETTIME_TIMEVAL(&now); if (net->last_sent_time.tv_sec) { - ms_goneby = (now.tv_sec - net->last_sent_time.tv_sec) * 1000; + ms_goneby = (uint32_t)(now.tv_sec - net->last_sent_time.tv_sec) * 1000; } else { ms_goneby = 0; } diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 516e58753163..7079cdf7c403 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -2738,7 +2738,7 @@ flags_out: sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times; sasoc->sasoc_number_peer_destinations = 0; sasoc->sasoc_peer_rwnd = 0; - sasoc->sasoc_local_rwnd = sbspace(&inp->sctp_socket->so_rcv); + sasoc->sasoc_local_rwnd = (uint32_t)sbspace(&inp->sctp_socket->so_rcv); SCTP_INP_RUNLOCK(inp); } else { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); @@ -2839,7 +2839,7 @@ flags_out: { struct sctp_hmacalgo *shmac; sctp_hmaclist_t *hmaclist; - uint32_t size; + size_t size; int i; SCTP_CHECK_AND_CAST(shmac, optval, struct sctp_hmacalgo, *optsize); @@ -2855,7 +2855,7 @@ flags_out: /* is there room for all of the hmac ids? */ size = sizeof(*shmac) + (hmaclist->num_algo * sizeof(shmac->shmac_idents[0])); - if ((size_t)(*optsize) < size) { + if (*optsize < size) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; SCTP_INP_RUNLOCK(inp); diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 0993f8eb302f..09d486038b65 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1936,7 +1936,7 @@ sctp_timeout_handler(void *t) type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timosecret); (void)SCTP_GETTIME_TIMEVAL(&tv); - inp->sctp_ep.time_of_secret_change = tv.tv_sec; + inp->sctp_ep.time_of_secret_change = (unsigned int)tv.tv_sec; inp->sctp_ep.last_secret_number = inp->sctp_ep.current_secret_number; inp->sctp_ep.current_secret_number++; @@ -6081,7 +6081,7 @@ get_more_data: copied_so_far += cp_len; freed_so_far += (uint32_t)cp_len; freed_so_far += MSIZE; - atomic_subtract_int(&control->length, cp_len); + atomic_subtract_int(&control->length, (int)cp_len); control->data = sctp_m_free(m); m = control->data; /* @@ -6123,10 +6123,10 @@ get_more_data: if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBFREE, (int)cp_len); } - atomic_subtract_int(&so->so_rcv.sb_cc, cp_len); + atomic_subtract_int(&so->so_rcv.sb_cc, (int)cp_len); if ((control->do_not_ref_stcb == 0) && stcb) { - atomic_subtract_int(&stcb->asoc.sb_cc, cp_len); + atomic_subtract_int(&stcb->asoc.sb_cc, (int)cp_len); } copied_so_far += cp_len; freed_so_far += (uint32_t)cp_len; @@ -6135,7 +6135,7 @@ get_more_data: sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0); } - atomic_subtract_int(&control->length, cp_len); + atomic_subtract_int(&control->length, (int)cp_len); } else { copied_so_far += cp_len; } @@ -6233,9 +6233,9 @@ get_more_data: } /* * We need to wait for more data a few things: - We don't - * release the I/O lock so we don't get someone else reading. - * - We must be sure to account for the case where what is added - * is NOT to our control when we wakeup. + * release the I/O lock so we don't get someone else + * reading. - We must be sure to account for the case where + * what is added is NOT to our control when we wakeup. */ /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109081319.188DJBKk006504>