]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
perf evsel: Fix uninitialized memory access to struct perf_sample
authorRobert Richter <robert.richter@amd.com>
Thu, 15 Dec 2011 16:32:39 +0000 (17:32 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 20 Dec 2011 15:26:47 +0000 (13:26 -0200)
Memory in struct perf_sample is not fully initialized during parsing.
Depending on sampling data some parts may left unchanged. Zero out
struct perf_sample first to avoid access to uninitialized memory.

Cc: Ingo Molnar <mingo@elte.hu>
Link: http://lkml.kernel.org/r/1323966762-8574-2-git-send-email-robert.richter@amd.com
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c

index 60ad0286759ef78f11f3dbf528d024da002a8023..667f3b78bb2c2f44fd4a93cbd94a80850cdd0e51 100644 (file)
@@ -460,7 +460,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
                u32 val32[2];
        } u;
 
-
+       memset(data, 0, sizeof(*data));
        data->cpu = data->pid = data->tid = -1;
        data->stream_id = data->id = data->time = -1ULL;