From: Chris Wilson Date: Sat, 25 Jul 2020 18:51:10 +0000 (+0100) Subject: locking/lockdep: Fix overflow in presentation of average lock-time X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1cd492f839c945c5396e02332385f220ac2d288d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git locking/lockdep: Fix overflow in presentation of average lock-time [ Upstream commit a7ef9b28aa8d72a1656fa6f0a01bbd1493886317 ] 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 Signed-off-by: Ingo Molnar Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20200725185110.11588-1-chris@chris-wilson.co.uk Signed-off-by: Sasha Levin --- diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c index 8b2ef15e3552..06c02cd0ff57 100644 --- a/kernel/locking/lockdep_proc.c +++ b/kernel/locking/lockdep_proc.c @@ -430,7 +430,7 @@ static void seq_lock_time(struct seq_file *m, struct lock_time *lt) seq_time(m, lt->min); seq_time(m, lt->max); seq_time(m, lt->total); - seq_time(m, lt->nr ? div_s64(lt->total, lt->nr) : 0); + seq_time(m, lt->nr ? div64_u64(lt->total, lt->nr) : 0); } static void seq_stats(struct seq_file *m, struct lock_stat_data *data)