From ed49dcb58b94fde6fcc793dd493faef8761e522f Mon Sep 17 00:00:00 2001 From: ihsinme <61293369+ihsinme@users.noreply.github.com> Date: Mon, 4 Jan 2021 23:22:28 +0300 Subject: [PATCH] Update sctp_cc_functions.c used transform (uint64_t) (srtt * srtt) is incorrect. first, the product will be counted in uint32_t, and only then the conversion to uint64_t will be performed. I couldn't find the importance of preemptive execution (srtt * srtt), so I suggest a simple fix. however, if the sequence of the product in the expression ((uint64_t) net-> mtu * (uint64_t) (srtt * srtt)) is important, then I can correct the commit to any of the options: 1. ((uint64_t) srtt * srtt * net-> mtu) 2. ((uint64_t) net-> mtu * ((uint64_t) srtt * srtt)) I would also pay attention to the comparison if (srtt> 0), given the unsigned nature of srtt, I would suggest replacing it with if (srtt != 0). --- usrsctplib/netinet/sctp_cc_functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usrsctplib/netinet/sctp_cc_functions.c b/usrsctplib/netinet/sctp_cc_functions.c index 57bcdaaa5..c7362ac06 100755 --- a/usrsctplib/netinet/sctp_cc_functions.c +++ b/usrsctplib/netinet/sctp_cc_functions.c @@ -793,7 +793,7 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, t_path_mptcp += (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_Z) / (((uint64_t)net->mtu) * (uint64_t)srtt); tmp = (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_N) / - ((uint64_t)net->mtu * (uint64_t)(srtt * srtt)); + ((uint64_t)net->mtu * srtt * srtt); if (tmp > max_path) { max_path = tmp; }