Browse Source

timer: fix timer_check() to iterate all levels.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 10 years ago
parent
commit
897219d64e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      ccan/timer/timer.c

+ 1 - 1
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
 	/* For other levels, "current" bucket has been emptied, and may contain
 	 * entries for the current + level_size bucket. */
 	 * 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);
 		uint64_t per_bucket = 1ULL << (TIMER_LEVEL_BITS * l);
 
 
 		off = ((timers->base >> (l*TIMER_LEVEL_BITS)) % PER_LEVEL);
 		off = ((timers->base >> (l*TIMER_LEVEL_BITS)) % PER_LEVEL);