From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753078AbcDXSSf (ORCPT ); Sun, 24 Apr 2016 14:18:35 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58619 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753013AbcDXSSd (ORCPT ); Sun, 24 Apr 2016 14:18:33 -0400 From: Colin King To: Len Brown , "Rafael J . Wysocki" , Hubert Chrzaniuk , Dasaratharaman Chandramouli Cc: linux-kernel@vger.kernel.org Subject: [PATCH] tools/power turbostat: fix overflow read on array slm_freq_table Date: Sun, 24 Apr 2016 19:18:24 +0100 Message-Id: <1461521904-9745-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King 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 --- 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