From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754208AbaCHBHa (ORCPT ); Fri, 7 Mar 2014 20:07:30 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:46461 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754162AbaCHBH0 (ORCPT ); Fri, 7 Mar 2014 20:07:26 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Uckelman , Jiri Olsa , Corey Ashford , Frederic Weisbecker , Ingo Molnar , Paul Mackerras , Peter Zijlstra , Arnaldo Carvalho de Melo , Vinson Lee Subject: [PATCH 3.4 53/99] perf tools: Fix cache event name generation Date: Fri, 7 Mar 2014 17:07:49 -0800 Message-Id: <20140308010613.310796412@linuxfoundation.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <20140308010611.468206150@linuxfoundation.org> References: <20140308010611.468206150@linuxfoundation.org> User-Agent: quilt/0.61-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiri Olsa commit 275ef3878f698941353780440fec6926107a320b upstream. If the event name is specified with all 3 components, the last one overwrites the previous one during the name composing within the parse_events_add_cache function. Fixing this by properly adjusting the string index. Reported-by: Joel Uckelman Signed-off-by: Jiri Olsa Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Joel Uckelman Cc: Paul Mackerras Cc: Peter Zijlstra LPU-Reference: 20120905175133.GA18352@krava.brq.redhat.com [ committer note: Remove the newline fix, done already in 42e1fb7 ] Signed-off-by: Arnaldo Carvalho de Melo Cc: Vinson Lee Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/parse-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -413,7 +413,7 @@ int parse_events_add_cache(struct list_h for (i = 0; (i < 2) && (op_result[i]); i++) { char *str = op_result[i]; - snprintf(name + n, MAX_NAME_LEN - n, "-%s", str); + n += snprintf(name + n, MAX_NAME_LEN - n, "-%s", str); if (cache_op == -1) { cache_op = parse_aliases(str, hw_cache_op,