From: Arnaldo Carvalho de Melo <[email protected]>

We were just skipping the syscalls not available in a particular
architecture without reflecting this in the number of entries in the
ev_qualifier_ids.nr variable, fix it.

This was done with the most minimalistic way, reusing the index variable
'i', a followup patch will further clean this by making 'i' renamed to
'nr_used' and using 'nr_allocated' in a few more places.

Reported-by: Leo Yan <[email protected]>
Tested-by: Leo Yan <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mathieu Poirier <[email protected]>
Cc: Mike Leach <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Suzuki K Poulose <[email protected]>
Fixes: 04c41bcb862b ("perf trace: Skip unknown syscalls when expanding strace 
like syscall groups")
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/builtin-trace.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 12f5ad98f8c1..fa9eb467eb4c 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1527,9 +1527,9 @@ static int trace__read_syscall_info(struct trace *trace, 
int id)
 
 static int trace__validate_ev_qualifier(struct trace *trace)
 {
-       int err = 0, i;
+       int err = 0;
        bool printed_invalid_prefix = false;
-       size_t nr_allocated;
+       size_t nr_allocated, i;
        struct str_node *pos;
 
        trace->ev_qualifier_ids.nr = strlist__nr_entries(trace->ev_qualifier);
@@ -1574,7 +1574,7 @@ static int trace__validate_ev_qualifier(struct trace 
*trace)
                        id = syscalltbl__strglobmatch_next(trace->sctbl, sc, 
&match_next);
                        if (id < 0)
                                break;
-                       if (nr_allocated == trace->ev_qualifier_ids.nr) {
+                       if (nr_allocated == i) {
                                void *entries;
 
                                nr_allocated += 8;
@@ -1587,11 +1587,11 @@ static int trace__validate_ev_qualifier(struct trace 
*trace)
                                }
                                trace->ev_qualifier_ids.entries = entries;
                        }
-                       trace->ev_qualifier_ids.nr++;
                        trace->ev_qualifier_ids.entries[i++] = id;
                }
        }
 
+       trace->ev_qualifier_ids.nr = i;
 out:
        if (printed_invalid_prefix)
                pr_debug("\n");
-- 
2.20.1

Reply via email to