From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbdH2VXk (ORCPT ); Tue, 29 Aug 2017 17:23:40 -0400 Received: from terminus.zytor.com ([65.50.211.136]:50017 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbdH2VXh (ORCPT ); Tue, 29 Aug 2017 17:23:37 -0400 Date: Tue, 29 Aug 2017 14:21:07 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: tglx@linutronix.de, mingo@kernel.org, jolsa@kernel.org, andi@firstfloor.org, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org, hpa@zytor.com, mark.rutland@arm.com, acme@redhat.com, dsahern@gmail.com Reply-To: hpa@zytor.com, mark.rutland@arm.com, dsahern@gmail.com, acme@redhat.com, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, a.p.zijlstra@chello.nl, namhyung@kernel.org, jolsa@kernel.org, andi@firstfloor.org, tglx@linutronix.de, mingo@kernel.org In-Reply-To: <20170824162737.7813-7-jolsa@kernel.org> References: <20170824162737.7813-7-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf values: Fix thread index bug Git-Commit-ID: 64eed1deb6d87f4c0efe03297f50367a3689eb56 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: 64eed1deb6d87f4c0efe03297f50367a3689eb56 Gitweb: http://git.kernel.org/tip/64eed1deb6d87f4c0efe03297f50367a3689eb56 Author: Jiri Olsa AuthorDate: Thu, 24 Aug 2017 18:27:33 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 28 Aug 2017 16:44:42 -0300 perf values: Fix thread index bug We are taking wrong index (+1) for first thread, which leaves thread with index 0 unused and uninitialized. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: David Ahern Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170824162737.7813-7-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/values.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c index 5de2e15..9ac36bf 100644 --- a/tools/perf/util/values.c +++ b/tools/perf/util/values.c @@ -98,7 +98,7 @@ static int perf_read_values__findnew_thread(struct perf_read_values *values, return i; } - i = values->threads + 1; + i = values->threads; values->value[i] = malloc(values->counters_max * sizeof(**values->value)); if (!values->value[i]) { pr_debug("failed to allocate read_values counters array"); @@ -106,7 +106,7 @@ static int perf_read_values__findnew_thread(struct perf_read_values *values, } values->pid[i] = pid; values->tid[i] = tid; - values->threads = i; + values->threads = i + 1; return i; }