diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2011-05-21 19:33:04 +0200 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2011-05-22 03:38:36 +0200 |
commit | a285412479b6d5af3e48273a92ec2f1987df8cd1 (patch) | |
tree | 29f68684cebb26b86c3dd0b0f0fc4e5d6553c989 /tools/perf/util/python.c | |
parent | 74429964d8e29c0107fa6e9cdf35b8f33f57405d (diff) | |
download | linux-a285412479b6d5af3e48273a92ec2f1987df8cd1.tar.bz2 |
perf tools: Pre-check sample size before parsing
Check that the total size of the sample fields having a fixed
size do not exceed the one of the whole event. This robustifies
the sample parsing.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Diffstat (limited to 'tools/perf/util/python.c')
-rw-r--r-- | tools/perf/util/python.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 8b0eff8b8283..4174c0990320 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -690,8 +690,9 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, return PyErr_NoMemory(); first = list_entry(evlist->entries.next, struct perf_evsel, node); - perf_event__parse_sample(event, first->attr.sample_type, sample_id_all, - &pevent->sample); + perf_event__parse_sample(event, first->attr.sample_type, + perf_sample_size(first->attr.sample_type), + sample_id_all, &pevent->sample); return pyevent; } |