aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Fischofer <bill.fischofer@linaro.org>2016-05-11 19:51:18 -0500
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-05-16 16:01:23 +0300
commitacca52168e42778498e637b278c7c3538dea7fbc (patch)
tree409e8df2f9a1d2d3d0c19b0b00992c4872c2a7b8
parent3589ee140d823019c550e953253c9dfc2021dc03 (diff)
validation: timer: verify timer successfully allocated
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.fischofer@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--test/validation/timer/timer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
index 378b427a0..1de09b2a9 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -306,6 +306,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);