From: Colin Ian King Date: Mon, 25 Apr 2016 12:03:15 +0000 (+0100) Subject: tools/power turbostat: fix error case overflow read of slm_freq_table[] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0a91e551527a7b931d36f4822b97e70536bd2bb3;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git tools/power turbostat: fix error case overflow read of slm_freq_table[] When i >= SLM_BCLK_FREQS, the frequency read from the slm_freq_table is off the end of the array because msr is set to 3 rather than the actual array index i. Set i to 3 rather than msr to fix this. Signed-off-by: Colin Ian King Signed-off-by: Len Brown --- diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 741fefa2f07e..12a6eea2d6ae 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -3036,7 +3036,7 @@ double slm_bclk(void) i = msr & 0xf; if (i >= SLM_BCLK_FREQS) { fprintf(outf, "SLM BCLK[%d] invalid\n", i); - msr = 3; + i = 3; } freq = slm_freq_table[i];