lkml.org 
[lkml]   [2011]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[tip:perf/core] perf evsel: Fix uninitialized memory access to struct perf_sample
    Commit-ID:  f3bda2c9a689b38c059f7cb2d761ff58a2996370
    Gitweb: http://git.kernel.org/tip/f3bda2c9a689b38c059f7cb2d761ff58a2996370
    Author: Robert Richter <robert.richter@amd.com>
    AuthorDate: Thu, 15 Dec 2011 17:32:39 +0100
    Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
    CommitDate: Tue, 20 Dec 2011 13:26:47 -0200

    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>
    ---
    tools/perf/util/evsel.c | 2 +-
    1 files changed, 1 insertions(+), 1 deletions(-)

    diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
    index 60ad028..667f3b7 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;


    \
     
     \ /
      Last update: 2011-12-21 09:45    [W:0.045 / U:1.624 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site