| From e2e1322c51085ba047cb17ace5b802f32ad57aa2 Mon Sep 17 00:00:00 2001 |
| From: Ikjoon Jang <ikjn@chromium.org> |
| Date: Sat, 11 Jan 2020 01:47:12 +0800 |
| Subject: [PATCH] cpuidle: teo: Fix intervals[] array indexing bug |
| |
| commit 57388a2ccb6c2f554fee39772886c69b796dde53 upstream. |
| |
| Fix a simple bug in rotating array index. |
| |
| Fixes: b26bf6ab716f ("cpuidle: New timer events oriented governor for tickless systems") |
| Signed-off-by: Ikjoon Jang <ikjn@chromium.org> |
| Cc: 5.1+ <stable@vger.kernel.org> # 5.1+ |
| Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c |
| index e5a30db5eef8..f2b0e1986704 100644 |
| --- a/drivers/cpuidle/governors/teo.c |
| +++ b/drivers/cpuidle/governors/teo.c |
| @@ -202,7 +202,7 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) |
| * pattern detection. |
| */ |
| cpu_data->intervals[cpu_data->interval_idx++] = measured_us; |
| - if (cpu_data->interval_idx > INTERVALS) |
| + if (cpu_data->interval_idx >= INTERVALS) |
| cpu_data->interval_idx = 0; |
| } |
| |
| -- |
| 2.7.4 |
| |