[PATCH] locking/lockdep: Fix UBSAN warnings

Kobe-CP Wu Kobe-CP.Wu at mediatek.com
Wed Jun 12 05:35:41 PDT 2019


On Wed, 2019-06-12 at 09:34 +0200, Peter Zijlstra wrote:
> On Wed, Jun 12, 2019 at 01:49:04PM +0800, Kobe Wu wrote:
> > Fix complaints from UBSAN about signed integer overflow.
> > 
> > ========================================================================
> > UBSAN: Undefined behaviour in kernel/locking/lockdep.c:2998:3
> > signed integer overflow:
> 
> I don't mind the patch, but this is an UBSAN bug and cannot therefore be
> a reason.

I think the description could be amended as follows.
There is unnecessary to mention the UBSAN bug.

locking/lockdep: add size of counters for lockdep statistics

When system has been running for a long time, signed integer counters 
are not enough for some lockdep statistics. Using unsigned long counters
can satisfy the requirement. Besides, most of lockdep statistics are 
unsigned. It is better to use unsigned int instead of int.





More information about the Linux-mediatek mailing list