|
@@ -67,7 +67,10 @@ static void tfrc_lh_calc_i_mean(struct tfrc_loss_hist *lh)
|
|
|
u32 i_i, i_tot0 = 0, i_tot1 = 0, w_tot = 0;
|
|
|
int i, k = tfrc_lh_length(lh) - 1; /* k is as in rfc3448bis, 5.4 */
|
|
|
|
|
|
- for (i=0; i <= k; i++) {
|
|
|
+ if (k <= 0)
|
|
|
+ return;
|
|
|
+
|
|
|
+ for (i = 0; i <= k; i++) {
|
|
|
i_i = tfrc_lh_get_interval(lh, i);
|
|
|
|
|
|
if (i < k) {
|
|
@@ -78,7 +81,6 @@ static void tfrc_lh_calc_i_mean(struct tfrc_loss_hist *lh)
|
|
|
i_tot1 += i_i * tfrc_lh_weights[i-1];
|
|
|
}
|
|
|
|
|
|
- BUG_ON(w_tot == 0);
|
|
|
lh->i_mean = max(i_tot0, i_tot1) / w_tot;
|
|
|
}
|
|
|
|