From: Tuukka Tikkanen Date: Wed, 14 Aug 2013 16:02:40 +0000 (+0300) Subject: cpuidle: Add a comment warning about possible overflow X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=decd51bbcd7fd949840da4cc634f6b70baa1b512;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git cpuidle: Add a comment warning about possible overflow The menu governor has a number of tunable constants that may be changed in the source. If certain combination of values are chosen, an overflow is possible when the correction_factor is being recalculated. This patch adds a warning regarding this possibility and describes the change needed for fixing the issue. The change should not be permanently enabled, as it will hurt performance when it is not needed. Signed-off-by: Tuukka Tikkanen Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index a56081ce170f..a8b31b0ca57f 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -21,6 +21,15 @@ #include #include +/* + * Please note when changing the tuning values: + * If (MAX_INTERESTING-1) * RESOLUTION > UINT_MAX, the result of + * a scaling operation multiplication may overflow on 32 bit platforms. + * In that case, #define RESOLUTION as ULL to get 64 bit result: + * #define RESOLUTION 1024ULL + * + * The default values do not overflow. + */ #define BUCKETS 12 #define INTERVALS 8 #define RESOLUTION 1024