Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753265AbcD1I0D (ORCPT ); Thu, 28 Apr 2016 04:26:03 -0400 Received: from terminus.zytor.com ([198.137.202.10]:44308 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752346AbcD1IZ4 (ORCPT ); Thu, 28 Apr 2016 04:25:56 -0400 Date: Thu, 28 Apr 2016 01:24:38 -0700 From: tip-bot for Adam Borowski Message-ID: Cc: jolsa@redhat.com, bp@suse.de, alexander.shishkin@linux.intel.com, mingo@kernel.org, eranian@google.com, tglx@linutronix.de, vincent.weaver@maine.edu, acme@redhat.com, efault@gmx.de, linux-kernel@vger.kernel.org, kilobyte@angband.pl, peterz@infradead.org, hpa@zytor.com Reply-To: kilobyte@angband.pl, hpa@zytor.com, peterz@infradead.org, acme@redhat.com, linux-kernel@vger.kernel.org, efault@gmx.de, tglx@linutronix.de, eranian@google.com, vincent.weaver@maine.edu, bp@suse.de, jolsa@redhat.com, mingo@kernel.org, alexander.shishkin@linux.intel.com In-Reply-To: <1461749731-30979-1-git-send-email-kilobyte@angband.pl> References: <1461749731-30979-1-git-send-email-kilobyte@angband.pl> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/x86/amd: Set the size of event map array to PERF_COUNT_HW_MAX Git-Commit-ID: 0a25556f84d5f79e68e9502bb1f32a43377ab2bf X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1950 Lines: 49 Commit-ID: 0a25556f84d5f79e68e9502bb1f32a43377ab2bf Gitweb: http://git.kernel.org/tip/0a25556f84d5f79e68e9502bb1f32a43377ab2bf Author: Adam Borowski AuthorDate: Wed, 27 Apr 2016 11:35:31 +0200 Committer: Ingo Molnar CommitDate: Thu, 28 Apr 2016 10:20:25 +0200 perf/x86/amd: Set the size of event map array to PERF_COUNT_HW_MAX The entry for PERF_COUNT_HW_REF_CPU_CYCLES is not used on AMD, but is referenced by filter_events() which expects undefined events to have a value of 0. Found via KASAN: UBSAN: Undefined behaviour in arch/x86/events/amd/core.c:132:30 index 9 is out of range for type 'u64 [9]' UBSAN: Undefined behaviour in arch/x86/events/amd/core.c:132:9 load of address ffffffff81c021c8 with insufficient space for an object of type 'const u64' Signed-off-by: Adam Borowski Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Borislav Petkov Cc: Jiri Olsa Cc: Mike Galbraith Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Link: http://lkml.kernel.org/r/1461749731-30979-1-git-send-email-kilobyte@angband.pl Signed-off-by: Ingo Molnar --- arch/x86/events/amd/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index 86a9bec..bd3e842 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -115,7 +115,7 @@ static __initconst const u64 amd_hw_cache_event_ids /* * AMD Performance Monitor K7 and later. */ -static const u64 amd_perfmon_event_map[] = +static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = { [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,