From c0854f72231631dbc278572ecb5d568053ff97a8 Mon Sep 17 00:00:00 2001 From: Igor Nabirushkin Date: Tue, 28 Apr 2015 10:04:15 +0400 Subject: [PATCH] misc: tegra-profiler: fix coverity issue Fix Coverity issue of out-of-bounds. Coverity id: 29855 Bug 1416640 Change-Id: I112daaad55c1a2de9fdb411a0591e4ed7bf50e6e Signed-off-by: Igor Nabirushkin Reviewed-on: http://git-master/r/730896 (cherry picked from commit 09c1b2add13aa7c6f4410c874ddad936913f5d19) Reviewed-on: http://git-master/r/748092 GVS: Gerrit_Virtual_Submit Reviewed-by: Andrey Trachenko Reviewed-by: Winnie Hsu --- drivers/misc/tegra-profiler/power_clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/tegra-profiler/power_clk.c b/drivers/misc/tegra-profiler/power_clk.c index 7af07539193..b7b198333fa 100644 --- a/drivers/misc/tegra-profiler/power_clk.c +++ b/drivers/misc/tegra-profiler/power_clk.c @@ -210,7 +210,7 @@ read_source(struct power_clk_source *s, int cpu) switch (s->type) { case QUADD_POWER_CLK_CPU: /* update cpu frequency */ - if (cpu < 0 || cpu >= POWER_CLK_MAX_VALUES) { + if (cpu < 0 || cpu >= max_t(int, s->nr, nr_cpu_ids)) { pr_err_once("error: cpu id: %d\n", cpu); break; } -- 2.39.2