提交 f3bda2c9 编写于 作者: R Robert Richter 提交者: Arnaldo Carvalho de Melo

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 <mingo@elte.hu>
Link: http://lkml.kernel.org/r/1323966762-8574-2-git-send-email-robert.richter@amd.comSigned-off-by: NRobert Richter <robert.richter@amd.com>
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 3e76ac78
...@@ -460,7 +460,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, ...@@ -460,7 +460,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
u32 val32[2]; u32 val32[2];
} u; } u;
memset(data, 0, sizeof(*data));
data->cpu = data->pid = data->tid = -1; data->cpu = data->pid = data->tid = -1;
data->stream_id = data->id = data->time = -1ULL; data->stream_id = data->id = data->time = -1ULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册