From: Rusty Russell Date: Tue, 19 May 2015 02:36:37 +0000 (+0930) Subject: timer: fix timer_check() to iterate all levels. X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=897219d64e60ff6bbe7b08c0425b6741cb5f7a94;hp=fc3a762c6629caf4af8c490c8f9ccff5ac9e5a16 timer: fix timer_check() to iterate all levels. Signed-off-by: Rusty Russell --- diff --git a/ccan/timer/timer.c b/ccan/timer/timer.c index 0abf05cd..0d7deb12 100644 --- a/ccan/timer/timer.c +++ b/ccan/timer/timer.c @@ -360,7 +360,7 @@ struct timers *timers_check(const struct timers *timers, const char *abortstr) /* For other levels, "current" bucket has been emptied, and may contain * entries for the current + level_size bucket. */ - for (l = 1; timers->level[l] && l < PER_LEVEL; l++) { + for (l = 1; l < ARRAY_SIZE(timers->level) && timers->level[l]; l++) { uint64_t per_bucket = 1ULL << (TIMER_LEVEL_BITS * l); off = ((timers->base >> (l*TIMER_LEVEL_BITS)) % PER_LEVEL);