From 2ef1533fa3fcc012de538164181da0d9ea179ab8 Mon Sep 17 00:00:00 2001 From: Robert Richter Date: Thu, 16 Aug 2012 21:10:17 +0200 Subject: [PATCH] --- yaml --- r: 323702 b: refs/heads/master c: f4d834367cda98eee3769638da6ad687607c74e6 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/tools/perf/util/evsel.h | 2 +- trunk/tools/perf/util/header.c | 11 +++++++---- trunk/tools/perf/util/header.h | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 6eaf6c026638..2b52d242b5d1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0985a94891c73740dea1e2697f9d598a4a7810ab +refs/heads/master: f4d834367cda98eee3769638da6ad687607c74e6 diff --git a/trunk/tools/perf/util/evsel.h b/trunk/tools/perf/util/evsel.h index 65f39fdf821a..94f6ba16747f 100644 --- a/trunk/tools/perf/util/evsel.h +++ b/trunk/tools/perf/util/evsel.h @@ -53,7 +53,7 @@ struct perf_evsel { u64 *id; struct perf_counts *counts; int idx; - int ids; + u32 ids; struct hists hists; char *name; struct event_format *tp_format; diff --git a/trunk/tools/perf/util/header.c b/trunk/tools/perf/util/header.c index 77832b807eff..471b0c42db3f 100644 --- a/trunk/tools/perf/util/header.c +++ b/trunk/tools/perf/util/header.c @@ -2240,7 +2240,7 @@ int perf_session__read_header(struct perf_session *session, int fd) } int perf_event__synthesize_attr(struct perf_tool *tool, - struct perf_event_attr *attr, u16 ids, u64 *id, + struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process) { union perf_event *ev; @@ -2261,9 +2261,12 @@ int perf_event__synthesize_attr(struct perf_tool *tool, memcpy(ev->attr.id, id, ids * sizeof(u64)); ev->attr.header.type = PERF_RECORD_HEADER_ATTR; - ev->attr.header.size = size; + ev->attr.header.size = (u16)size; - err = process(tool, ev, NULL, NULL); + if (ev->attr.header.size == size) + err = process(tool, ev, NULL, NULL); + else + err = -E2BIG; free(ev); @@ -2292,7 +2295,7 @@ int perf_event__synthesize_attrs(struct perf_tool *tool, int perf_event__process_attr(union perf_event *event, struct perf_evlist **pevlist) { - unsigned int i, ids, n_ids; + u32 i, ids, n_ids; struct perf_evsel *evsel; struct perf_evlist *evlist = *pevlist; diff --git a/trunk/tools/perf/util/header.h b/trunk/tools/perf/util/header.h index 2d42b3e1826f..24962e707e5b 100644 --- a/trunk/tools/perf/util/header.h +++ b/trunk/tools/perf/util/header.h @@ -99,7 +99,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir); int perf_event__synthesize_attr(struct perf_tool *tool, - struct perf_event_attr *attr, u16 ids, u64 *id, + struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process); int perf_event__synthesize_attrs(struct perf_tool *tool, struct perf_session *session,