]> git.karo-electronics.de Git - linux-beck.git/commit
cpuidle: Check called function parameter in get_typical_interval()
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>
Wed, 14 Aug 2013 16:02:36 +0000 (19:02 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 22 Aug 2013 22:24:16 +0000 (00:24 +0200)
commit0d6a7ffa4cc67cc70bf1f4e24fbb0747632845a2
treef551d52b69ba39d22e144c468cf52c4dc73a5afe
parent017099e25fb7e482a249d36a654556d32f601f71
cpuidle: Check called function parameter in get_typical_interval()

get_typical_interval() uses int_sqrt() in calculation of standard
deviation. The formal parameter of int_sqrt() is unsigned long, which
may on some platforms be smaller than the 64 bit unsigned integer used
as the actual parameter. The overflow can occur frequently when actual
idle period lengths are in hundreds of milliseconds.

This patch adds a check for such overflow and rejects the candidate
average when an overflow would occur.

Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/governors/menu.c