Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2031 by
adding a check to ensure that at least one timer is allocated before
potentially dividing by zero.

Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 test/validation/timer/timer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
index aad11aa..9d637d0 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -304,6 +304,8 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
                tt[i].tick = TICK_INVALID;
        }
        allocated = i;
+       if (allocated == 0)
+               CU_FAIL_FATAL("unable to alloc a timer");
        odp_atomic_fetch_add_u32(&timers_allocated, allocated);
 
        odp_barrier_wait(&test_barrier);
-- 
2.7.4

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to