Skip to content

Commit a7ef9b2

Browse files
ickleIngo Molnar
authored andcommitted
locking/lockdep: Fix overflow in presentation of average lock-time
Though the number of lock-acquisitions is tracked as unsigned long, this is passed as the divisor to div_s64() which interprets it as a s32, giving nonsense values with more than 2 billion acquisitons. E.g. acquisitions holdtime-min holdtime-max holdtime-total holdtime-avg ------------------------------------------------------------------------- 2350439395 0.07 353.38 649647067.36 0.-32 Signed-off-by: Chris Wilson <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 23ee3e4 commit a7ef9b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/locking/lockdep_proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ static void seq_lock_time(struct seq_file *m, struct lock_time *lt)
423423
seq_time(m, lt->min);
424424
seq_time(m, lt->max);
425425
seq_time(m, lt->total);
426-
seq_time(m, lt->nr ? div_s64(lt->total, lt->nr) : 0);
426+
seq_time(m, lt->nr ? div64_u64(lt->total, lt->nr) : 0);
427427
}
428428

429429
static void seq_stats(struct seq_file *m, struct lock_stat_data *data)

0 commit comments

Comments
 (0)