Skip to content

Commit f3bda2c

Browse files
Robert Richteracmel
authored andcommitted
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.com Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 3e76ac7 commit f3bda2c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tools/perf/util/evsel.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
460460
u32 val32[2];
461461
} u;
462462

463-
463+
memset(data, 0, sizeof(*data));
464464
data->cpu = data->pid = data->tid = -1;
465465
data->stream_id = data->id = data->time = -1ULL;
466466

0 commit comments

Comments
 (0)