From: Ikjoon Jang Date: Fri, 10 Jan 2020 17:47:12 +0000 (+0800) Subject: cpuidle: teo: Fix intervals[] array indexing bug X-Git-Tag: v5.5-rc7~29^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=57388a2ccb6c2f554fee39772886c69b796dde53;p=linux-2.6-block.git cpuidle: teo: Fix intervals[] array indexing bug Fix a simple bug in rotating array index. Fixes: b26bf6ab716f ("cpuidle: New timer events oriented governor for tickless systems") Signed-off-by: Ikjoon Jang Cc: 5.1+ # 5.1+ Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c index de7e706efd46..6deaaf5f05b5 100644 --- a/drivers/cpuidle/governors/teo.c +++ b/drivers/cpuidle/governors/teo.c @@ -198,7 +198,7 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) * pattern detection. */ cpu_data->intervals[cpu_data->interval_idx++] = measured_ns; - if (cpu_data->interval_idx > INTERVALS) + if (cpu_data->interval_idx >= INTERVALS) cpu_data->interval_idx = 0; }