diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2020-09-11 15:28:14 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-09-17 15:36:52 +0000 |
commit | e62f6a7e9d6af7c391fc1e65bd8646994797ccd4 (patch) | |
tree | 92f8c38dbae4b6aed35911432a8d35921e0d0c8d /src/osmo-bsc | |
parent | 127aeddab92373cb25c00bfe29fecd409d1c66d0 (diff) |
osmo-bsc: fix a crash when receiving a RACH LOAD IND with 0
Change-Id: Ia395d4ec70107688856ef0cd5daa6124a7da834b
Diffstat (limited to 'src/osmo-bsc')
-rw-r--r-- | src/osmo-bsc/abis_rsl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c index 2af01d963..858c683e1 100644 --- a/src/osmo-bsc/abis_rsl.c +++ b/src/osmo-bsc/abis_rsl.c @@ -1732,8 +1732,14 @@ static int rsl_rx_ccch_load(struct msgb *msg) sd.rach_busy_count = rslh->data[4] << 8 | rslh->data[5]; sd.rach_access_count = rslh->data[6] << 8 | rslh->data[7]; /* update stats group */ - busy_percent = (int32_t) sd.rach_busy_count * 100 / (int32_t) sd.rach_slot_count; - access_percent = (int32_t) sd.rach_access_count * 100 / (int32_t) sd.rach_slot_count; + if (sd.rach_slot_count) { + access_percent = (int32_t) sd.rach_access_count * 100 / (int32_t) sd.rach_slot_count; + busy_percent = (int32_t) sd.rach_busy_count * 100 / (int32_t) sd.rach_slot_count; + } else { + access_percent = 0; + busy_percent = 100; + } + osmo_stat_item_set(sd.bts->bts_statg->items[BTS_STAT_RACH_BUSY], busy_percent); osmo_stat_item_set(sd.bts->bts_statg->items[BTS_STAT_RACH_ACCESS], access_percent); /* dispatch signal */ |