diff options
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r-- | tools/perf/util/header.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 2b9f898efea6..8847bec64c54 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -922,6 +922,14 @@ perf_header__find_attr(u64 id, struct perf_header *header) | |||
922 | { | 922 | { |
923 | int i; | 923 | int i; |
924 | 924 | ||
925 | /* | ||
926 | * We set id to -1 if the data file doesn't contain sample | ||
927 | * ids. Check for this and avoid walking through the entire | ||
928 | * list of ids which may be large. | ||
929 | */ | ||
930 | if (id == -1ULL) | ||
931 | return NULL; | ||
932 | |||
925 | for (i = 0; i < header->attrs; i++) { | 933 | for (i = 0; i < header->attrs; i++) { |
926 | struct perf_header_attr *attr = header->attr[i]; | 934 | struct perf_header_attr *attr = header->attr[i]; |
927 | int j; | 935 | int j; |