]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tools/power turbostat: fix error case overflow read of slm_freq_table[]
authorColin Ian King <colin.king@canonical.com>
Mon, 25 Apr 2016 12:03:15 +0000 (13:03 +0100)
committerLen Brown <len.brown@intel.com>
Thu, 1 Dec 2016 06:33:17 +0000 (01:33 -0500)
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>
tools/power/x86/turbostat/turbostat.c

index 741fefa2f07ee168eab1eeb89850e24d909e58c2..12a6eea2d6ae60090b094365e730e20cf646536c 100644 (file)
@@ -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];