提交 6b95ed34 编写于 作者: P Peter Zijlstra 提交者: Paul Mackerras

perf, powerpc: Use perf_sample_data_init() for the FSL code

We should use perf_sample_data_init() to initialize struct
perf_sample_data.  As explained in the description of commit dc1d628a
("perf: Provide generic perf_sample_data initialization"), it is
possible for userspace to get the kernel to dereference data.raw,
so if it is not initialized, that means that unprivileged userspace
can possibly oops the kernel.  Using perf_sample_data_init makes sure
it gets initialized to NULL.

This conversion should have been included in commit dc1d628a, but it
got missed.
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: NKumar Gala <kumar.gala@freescale.com>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 1a041a23
...@@ -566,9 +566,9 @@ static void record_and_restart(struct perf_event *event, unsigned long val, ...@@ -566,9 +566,9 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
* Finally record data if requested. * Finally record data if requested.
*/ */
if (record) { if (record) {
struct perf_sample_data data = { struct perf_sample_data data;
.period = event->hw.last_period,
}; perf_sample_data_init(&data, 0);
if (perf_event_overflow(event, nmi, &data, regs)) { if (perf_event_overflow(event, nmi, &data, regs)) {
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册