This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
dexter gerrit-no-reply at lists.osmocom.orgdexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/16067 ) Change subject: scheduler_trx.c: avoid division by zero when calculating BER ...................................................................... scheduler_trx.c: avoid division by zero when calculating BER There is theoretical risk that when calculating the BER that a division by zero occurrs. Lets add a check to avoid n_errors / n_bits_total when n_bits_total is zero. Related: CID#205696 Change-Id: I1c0731b9a60be4b8c0c84b85b4403168120ceacd --- M src/osmo-bts-trx/scheduler_trx.c 1 file changed, 6 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/67/16067/1 diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 9945b2c..0f1b233 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -1149,6 +1149,7 @@ struct gsm_lchan *lchan = get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn); unsigned int fn_begin; + float ber; /* handle rach, if handover rach detection is turned on */ if (chan_state->ho_rach_detect == 1) @@ -1212,10 +1213,12 @@ (((bi->fn + 26 - 7) % 26) >> 2) & 1, chan_state->codec, chan_state->codecs, &chan_state->ul_ft, &chan_state->ul_cmr, &n_errors, &n_bits_total); + if (n_bits_total == 0) + ber = 1; + else + ber = (float)n_errors / (float)n_bits_total; if (rc) - trx_loop_amr_input(l1t, - trx_chan_desc[chan].chan_nr | bi->tn, chan_state, - (float)n_errors/(float)n_bits_total); + trx_loop_amr_input(l1t, trx_chan_desc[chan].chan_nr | bi->tn, chan_state, ber); amr = 2; /* we store tch_data + 2 header bytes */ /* only good speech frames get rtp header */ if (rc != GSM_MACBLOCK_LEN && rc >= 4) { -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/16067 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I1c0731b9a60be4b8c0c84b85b4403168120ceacd Gerrit-Change-Number: 16067 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191114/107f8543/attachment.htm>