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>
This commit is contained in:
parent
01a67adfc5
commit
0a91e55152
@ -3036,7 +3036,7 @@ double slm_bclk(void)
|
|||||||
i = msr & 0xf;
|
i = msr & 0xf;
|
||||||
if (i >= SLM_BCLK_FREQS) {
|
if (i >= SLM_BCLK_FREQS) {
|
||||||
fprintf(outf, "SLM BCLK[%d] invalid\n", i);
|
fprintf(outf, "SLM BCLK[%d] invalid\n", i);
|
||||||
msr = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
freq = slm_freq_table[i];
|
freq = slm_freq_table[i];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user