aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-10-30 14:49:45 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2019-10-31 13:08:57 +0100
commita9d88af59461f36a92cc6d900b3f9e811e6fdd72 (patch)
tree9011316fd54a575f6697f34cc7f043f78f98efb5
parent132987daf40739bfa4a2c87a2cf1e04365c9510f (diff)
scheduler_trx: initalize n_errors, n_bursts_bits, n_bits_total
Make sure the variables n_errors, n_bursts_bits, n_bits_total are always initalized. For example in rx_tchh_fn() the value for n_errors is defined in a switch statement, where the default lets n_errors uninitalized, which is in that particular case a theoretical problem, however, lets make sure that the variables n_errors, n_bursts_bits and n_bits_total are always initalized with 0 Related: CID#205452 Related: CID#205451 Change-Id: If28ea11cc111c7d73ca47b25e65ce399e5baa4c1
-rw-r--r--src/osmo-bts-trx/scheduler_trx.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 88e4f3a4..9945b2ce 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -783,7 +783,8 @@ int rx_rach_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, const struct trx_ul_burst_ind *bi)
{
struct osmo_phsap_prim l1sap;
- int n_errors, n_bits_total;
+ int n_errors = 0;
+ int n_bits_total = 0;
uint16_t ra11;
uint8_t ra;
int rc;
@@ -904,7 +905,8 @@ int rx_data_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
int32_t *ci_cb_sum = &chan_state->ci_cb_sum;
uint8_t *ci_cb_num = &chan_state->ci_cb_num;
uint8_t l2[GSM_MACBLOCK_LEN], l2_len;
- int n_errors, n_bits_total;
+ int n_errors = 0;
+ int n_bits_total = 0;
int16_t lqual_cb;
uint16_t ber10k;
int rc;
@@ -1020,7 +1022,9 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
int32_t *ci_cb_sum = &chan_state->ci_cb_sum;
uint8_t *ci_cb_num = &chan_state->ci_cb_num;
uint8_t l2[EGPRS_0503_MAX_BYTES];
- int n_errors, n_bursts_bits, n_bits_total;
+ int n_errors = 0;
+ int n_bursts_bits = 0;
+ int n_bits_total = 0;
int16_t lqual_cb;
uint16_t ber10k;
int rc;
@@ -1139,7 +1143,8 @@ int rx_tchf_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t tch_mode = chan_state->tch_mode;
uint8_t tch_data[128]; /* just to be safe */
int rc, amr = 0;
- int n_errors, n_bits_total;
+ int n_errors = 0;
+ int n_bits_total = 0;
bool bfi_flag = false;
struct gsm_lchan *lchan =
get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn);
@@ -1335,7 +1340,8 @@ int rx_tchh_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t tch_mode = chan_state->tch_mode;
uint8_t tch_data[128]; /* just to be safe */
int rc, amr = 0;
- int n_errors, n_bits_total;
+ int n_errors = 0;
+ int n_bits_total = 0;
bool bfi_flag = false;
struct gsm_lchan *lchan =
get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn);