]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.83/perf-tools-fix-cache-event-name-generation.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.83 / perf-tools-fix-cache-event-name-generation.patch
1 From 275ef3878f698941353780440fec6926107a320b Mon Sep 17 00:00:00 2001
2 From: Jiri Olsa <jolsa@redhat.com>
3 Date: Wed, 5 Sep 2012 19:51:33 +0200
4 Subject: perf tools: Fix cache event name generation
5
6 From: Jiri Olsa <jolsa@redhat.com>
7
8 commit 275ef3878f698941353780440fec6926107a320b upstream.
9
10 If the event name is specified with all 3 components, the last one
11 overwrites the previous one during the name composing within the
12 parse_events_add_cache function.
13
14 Fixing this by properly adjusting the string index.
15
16 Reported-by: Joel Uckelman <joel@lightboxtechnologies.com>
17 Signed-off-by: Jiri Olsa <jolsa@redhat.com>
18 Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
19 Cc: Frederic Weisbecker <fweisbec@gmail.com>
20 Cc: Ingo Molnar <mingo@elte.hu>
21 Cc: Joel Uckelman <joel@lightboxtechnologies.com>
22 Cc: Paul Mackerras <paulus@samba.org>
23 Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
24 LPU-Reference: 20120905175133.GA18352@krava.brq.redhat.com
25 [ committer note: Remove the newline fix, done already in 42e1fb7 ]
26 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
27 Cc: Vinson Lee <vlee@twopensource.com>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30 ---
31 tools/perf/util/parse-events.c | 2 +-
32 1 file changed, 1 insertion(+), 1 deletion(-)
33
34 --- a/tools/perf/util/parse-events.c
35 +++ b/tools/perf/util/parse-events.c
36 @@ -413,7 +413,7 @@ int parse_events_add_cache(struct list_h
37 for (i = 0; (i < 2) && (op_result[i]); i++) {
38 char *str = op_result[i];
39
40 - snprintf(name + n, MAX_NAME_LEN - n, "-%s", str);
41 + n += snprintf(name + n, MAX_NAME_LEN - n, "-%s", str);
42
43 if (cache_op == -1) {
44 cache_op = parse_aliases(str, hw_cache_op,