aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/timekeeping_debug.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-11-01 09:17:57 +0000
committerRussell King <rmk+kernel@armlinux.org.uk>2016-11-01 09:17:57 +0000
commit9902aa4728fe9128ea45f1a772e2238d64d8cdc5 (patch)
treecca30efb3ad2126fcb10aa6349ed799a5656e851 /kernel/time/timekeeping_debug.c
parentARM: dts: am335x-boneblack: Add HDMI audio support (diff)
parentdrm/i2c: tda998x: mali-dp: hdlcd: refactor connector registration (diff)
Merge branch 'drm-tda998x-mali' into drm-tda998x-devel
Diffstat (limited to 'kernel/time/timekeeping_debug.c')
-rw-r--r--kernel/time/timekeeping_debug.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/time/timekeeping_debug.c b/kernel/time/timekeeping_debug.c
index f6bd65236712..107310a6f36f 100644
--- a/kernel/time/timekeeping_debug.c
+++ b/kernel/time/timekeeping_debug.c
@@ -23,7 +23,9 @@
#include "timekeeping_internal.h"
-static unsigned int sleep_time_bin[32] = {0};
+#define NUM_BINS 32
+
+static unsigned int sleep_time_bin[NUM_BINS] = {0};
static int tk_debug_show_sleep_time(struct seq_file *s, void *data)
{
@@ -69,6 +71,9 @@ late_initcall(tk_debug_sleep_time_init);
void tk_debug_account_sleep_time(struct timespec64 *t)
{
- sleep_time_bin[fls(t->tv_sec)]++;
+ /* Cap bin index so we don't overflow the array */
+ int bin = min(fls(t->tv_sec), NUM_BINS-1);
+
+ sleep_time_bin[bin]++;
}