From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199AbdBJH4a (ORCPT ); Fri, 10 Feb 2017 02:56:30 -0500 Received: from terminus.zytor.com ([65.50.211.136]:51834 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751233AbdBJH4X (ORCPT ); Fri, 10 Feb 2017 02:56:23 -0500 Date: Thu, 9 Feb 2017 23:55:15 -0800 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org, namhyung@kernel.org, tglx@linutronix.de, mingo@kernel.org, dsahern@gmail.com, acme@redhat.com, hpa@zytor.com, a.p.zijlstra@chello.nl, kan.liang@intel.com Reply-To: kan.liang@intel.com, a.p.zijlstra@chello.nl, hpa@zytor.com, acme@redhat.com, dsahern@gmail.com, mingo@kernel.org, tglx@linutronix.de, namhyung@kernel.org, linux-kernel@vger.kernel.org, jolsa@kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf header: Fix handling of PERF_EVENT_UPDATE__SCALE Git-Commit-ID: 8434a2ec13d5c8cb25716950bfbf7c9d7b64628a 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 Commit-ID: 8434a2ec13d5c8cb25716950bfbf7c9d7b64628a Gitweb: http://git.kernel.org/tip/8434a2ec13d5c8cb25716950bfbf7c9d7b64628a Author: Arnaldo Carvalho de Melo AuthorDate: Wed, 8 Feb 2017 21:57:22 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 22:06:18 -0300 perf header: Fix handling of PERF_EVENT_UPDATE__SCALE In commit daeecbc0c431 ("perf tools: Add event_update event scale type"), the handling of PERF_EVENT_UPDATE__SCALE cast struct event_update_event->data to a pointer to event_update_event_scale, uses some field from this casted struct and then ends up falling through to the handling of another event type, PERF_EVENT_UPDATE__CPUS were it casts that ev->data to yet another type, oops, fix it by inserting the missing break. Noticed when building perf using gcc 7 on Fedora Rawhide: util/header.c: In function 'perf_event__process_event_update': util/header.c:3207:16: error: this statement may fall through [-Werror=implicit-fallthrough=] evsel->scale = ev_scale->scale; ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ util/header.c:3208:2: note: here case PERF_EVENT_UPDATE__CPUS: ^~~~ This wasn't noticed because probably PERF_EVENT_UPDATE__CPUS comes after PERF_EVENT_UPDATE__SCALE, so we would just create a bogus evsel->own_cpus when processing a PERF_EVENT_UPDATE__SCALE to then leak it and create a new cpu map with the correct data. Cc: David Ahern Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Cc: Peter Zijlstra Fixes: daeecbc0c431 ("perf tools: Add event_update event scale type") Link: http://lkml.kernel.org/n/tip-lukcf9hdj092ax2914ss95at@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/header.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index c567d9f..3d12c16 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3205,6 +3205,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused, case PERF_EVENT_UPDATE__SCALE: ev_scale = (struct event_update_event_scale *) ev->data; evsel->scale = ev_scale->scale; + break; case PERF_EVENT_UPDATE__CPUS: ev_cpus = (struct event_update_event_cpus *) ev->data;