aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-12-05 01:01:38 +0100
committerIvan Kluchnikov <kluchnikovi@gmail.com>2018-09-03 15:00:10 +0300
commit42b39418cdc94eb76815180cb2a9ebe4aa1bcb7e (patch)
tree14107aaaf3eb64448e69b9a33f3bcba35cefc3ed
parent133faf012160c767bf78b3a7f70646b5449b36de (diff)
fixup: neigh_meas_avg: detect invalid window size as <=0, log if invalid
-rw-r--r--openbsc/src/libbsc/handover_decision.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/openbsc/src/libbsc/handover_decision.c b/openbsc/src/libbsc/handover_decision.c
index 354363ac2..98c9dce87 100644
--- a/openbsc/src/libbsc/handover_decision.c
+++ b/openbsc/src/libbsc/handover_decision.c
@@ -80,8 +80,10 @@ static int neigh_meas_avg(struct neigh_meas_proc *nmp, int window)
if (window < nmp->rxlev_cnt)
window = nmp->rxlev_cnt;
/* this should never happen */
- if (window == 0)
+ if (window <= 0) {
+ LOGP(DHO, LOGL_ERROR, "Requested Neighbor RxLev for invalid window size of %d\n", window);
return 0;
+ }
idx = calc_initial_idx(ARRAY_SIZE(nmp->rxlev),
nmp->rxlev_cnt % ARRAY_SIZE(nmp->rxlev),