Skip to content

Commit

Permalink
perf, powerpc: Use perf_sample_data_init() for the FSL code
Browse files Browse the repository at this point in the history
We should use perf_sample_data_init() to initialize struct
perf_sample_data.  As explained in the description of commit dc1d628
("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 dc1d628, but it
got missed.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Peter Zijlstra authored and Paul Mackerras committed Jul 27, 2010
1 parent 1a041a2 commit 6b95ed3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/powerpc/kernel/perf_event_fsl_emb.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
* Finally record data if requested.
*/
if (record) {
struct perf_sample_data data = {
.period = event->hw.last_period,
};
struct perf_sample_data data;

perf_sample_data_init(&data, 0);

if (perf_event_overflow(event, nmi, &data, regs)) {
/*
Expand Down

0 comments on commit 6b95ed3

Please sign in to comment.