Return-Path: Received: from fldsmtpe03.verizon.com ([140.108.26.142]:57302 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753508AbdJGWiU (ORCPT ); Sat, 7 Oct 2017 18:38:20 -0400 From: "Levin, Alexander (Sasha Levin)" Cc: Taeung Song , Jiri Olsa , Namhyung Kim , Peter Zijlstra , Wang Nan , Arnaldo Carvalho de Melo , "Levin, Alexander (Sasha Levin)" To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH review for 4.9 19/50] perf tools: Only increase index if perf_evsel__new_idx() succeeds Date: Sat, 7 Oct 2017 22:36:50 +0000 Message-ID: <20171007223636.24797-19-alexander.levin@verizon.com> References: <20171007223636.24797-1-alexander.levin@verizon.com> In-Reply-To: <20171007223636.24797-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Taeung Song [ Upstream commit 75fc5ae5cc53fff71041ecadeb3354a2b4c9fe42 ] Signed-off-by: Taeung Song Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1485952447-7013-2-git-send-email-treeze.taeu= ng@gmail.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/parse-events.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.= c index 4e778eae1510..415a9c38d9f0 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -309,10 +309,11 @@ __add_event(struct list_head *list, int *idx, =20 event_attr_init(attr); =20 - evsel =3D perf_evsel__new_idx(attr, (*idx)++); + evsel =3D perf_evsel__new_idx(attr, *idx); if (!evsel) return NULL; =20 + (*idx)++; evsel->cpus =3D cpu_map__get(cpus); evsel->own_cpus =3D cpu_map__get(cpus); =20 --=20 2.11.0