commit | 97aeb08fef06b01afbd0da0cb3c831fcf2d8c7bb | [log] [tgz] |
---|---|---|
author | Holger Hans Peter Freyther <zecke@selfish.org> | Fri Jul 23 19:46:04 2010 +0800 |
committer | Holger Hans Peter Freyther <zecke@selfish.org> | Fri Jul 23 19:46:04 2010 +0800 |
tree | 322fc0ab9fa0c75a2a7a8c8bf22a2faf182439ba | |
parent | a624c53652f04c7aaecf1e834e2107dae5e8355b [diff] [blame] |
meas_rep.c: clang reports a possible division by zero Check the input and exit early if we have no measurement reports to avoid a possible division by zero.
diff --git a/openbsc/src/meas_rep.c b/openbsc/src/meas_rep.c index 4b9cc1a..8b5bff1 100644 --- a/openbsc/src/meas_rep.c +++ b/openbsc/src/meas_rep.c
@@ -76,6 +76,9 @@ unsigned int i, idx; int avg = 0; + if (num < 1) + return 0; + idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), lchan->meas_rep_idx, num);