diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c index c517483fd614efb3a1b89b6c2acf7f9db6b30a77..a55f15d7651d5a03423b31a34bc925322ed7ccc3 100644 --- a/Documentation/perf_counter/builtin-report.c +++ b/Documentation/perf_counter/builtin-report.c @@ -3,6 +3,7 @@ #include <libelf.h> #include <gelf.h> #include <elf.h> +#include <ctype.h> #include "util/list.h" #include "util/rbtree.h" @@ -408,13 +409,20 @@ static int load_kallsyms(void) int len = hex2long(line, &start); - len += 3; /* ' t ' */ - if (len >= line_len) + len++; + if (len + 2 >= line_len) + continue; + + char symbol_type = line[len]; + /* + * We're interested only in code ('T'ext) + */ + if (toupper(symbol_type) != 'T') continue; /* * Well fix up the end later, when we have all sorted. */ - struct symbol *sym = symbol__new(start, 0xdead, line + len); + struct symbol *sym = symbol__new(start, 0xdead, line + len + 2); if (sym == NULL) goto out_delete_dso;