* [PATCH] tools/power turbostat: fix overflow read on array slm_freq_table
@ 2016-04-24 18:18 Colin King
2016-04-25 12:00 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2016-04-24 18:18 UTC (permalink / raw)
To: Len Brown, Rafael J . Wysocki, Hubert Chrzaniuk,
Dasaratharaman Chandramouli
Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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>
---
tools/power/x86/turbostat/turbostat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index acbf7ff..a66f07c 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -3050,7 +3050,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];
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tools/power turbostat: fix overflow read on array slm_freq_table
2016-04-24 18:18 [PATCH] tools/power turbostat: fix overflow read on array slm_freq_table Colin King
@ 2016-04-25 12:00 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2016-04-25 12:00 UTC (permalink / raw)
To: Colin King, Len Brown
Cc: Hubert Chrzaniuk, Dasaratharaman Chandramouli, linux-kernel
On 4/24/2016 8:18 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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>
Can you please CC this to linux-pm@vger.kernel.org? It is easier to
handle then.
> ---
> tools/power/x86/turbostat/turbostat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
> index acbf7ff..a66f07c 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -3050,7 +3050,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];
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-25 12:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-24 18:18 [PATCH] tools/power turbostat: fix overflow read on array slm_freq_table Colin King
2016-04-25 12:00 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox