timer: fix timer_check() to iterate all levels.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 19 May 2015 02:36:37 +0000 (12:06 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 19 May 2015 02:36:37 +0000 (12:06 +0930)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/timer/timer.c

index 0abf05cd419ee8111312450872e80b53fee1ebb2..0d7deb127748b3130a1270f75ebc6ecec1fbf583 100644 (file)
@@ -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);