]> git.baikalelectronics.ru Git - kernel.git/commit
clockevents: Prevent shift out of bounds
authorThomas Gleixner <tglx@linutronix.de>
Mon, 20 Oct 2014 11:07:50 +0000 (15:07 +0400)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 25 Oct 2014 08:43:15 +0000 (10:43 +0200)
commit10337bd1c8669586063f137148835d23270746ed
tree4694d20120da394c2d501ef7eb4b9f7d5dd8ec90
parent01f93eba228b53b8b27bb8bbba7ff40592ce57fe
clockevents: Prevent shift out of bounds

Andrey reported that on a kernel with UBSan enabled he found:

     UBSan: Undefined behaviour in ../kernel/time/clockevents.c:75:34

     I guess it should be 1ULL here instead of 1U:
            (!ismax || evt->mult <= (1U << evt->shift)))

That's indeed the correct solution because shift might be 32.

Reported-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/time/clockevents.c