diff options
author | Colin Ian King <colin.king@canonical.com> | 2016-04-25 08:03:15 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2016-12-01 01:33:17 -0500 |
commit | 0a91e551527a7b931d36f4822b97e70536bd2bb3 (patch) | |
tree | 925a0597f1a2185b8265f91c39745a41c786f506 /tools | |
parent | 01a67adfc5d73d24e999d9cf65b5b8a6687187b8 (diff) |
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 <colin.king@canonical.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) | |||
3036 | i = msr & 0xf; | 3036 | i = msr & 0xf; |
3037 | if (i >= SLM_BCLK_FREQS) { | 3037 | if (i >= SLM_BCLK_FREQS) { |
3038 | fprintf(outf, "SLM BCLK[%d] invalid\n", i); | 3038 | fprintf(outf, "SLM BCLK[%d] invalid\n", i); |
3039 | msr = 3; | 3039 | i = 3; |
3040 | } | 3040 | } |
3041 | freq = slm_freq_table[i]; | 3041 | freq = slm_freq_table[i]; |
3042 | 3042 | ||