From: Robert Richter Date: Thu, 15 Dec 2011 16:32:39 +0000 (+0100) Subject: perf evsel: Fix uninitialized memory access to struct perf_sample X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f3bda2c9a689b38c059f7cb2d761ff58a2996370;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git perf evsel: Fix uninitialized memory access to struct perf_sample 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 Link: http://lkml.kernel.org/r/1323966762-8574-2-git-send-email-robert.richter@amd.com Signed-off-by: Robert Richter Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 60ad0286759e..667f3b78bb2c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -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;