lkml.org 
[lkml]   [2018]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[for-next][PATCH 10/18] tracing: Uninitialized variable in create_tracing_map_fields()
    From: Dan Carpenter <dan.carpenter@oracle.com>

    Smatch complains that idx can be used uninitialized when we check if
    (idx < 0). It has to be the first iteration through the loop and the
    HIST_FIELD_FL_STACKTRACE bit has to be clear and the HIST_FIELD_FL_VAR
    bit has to be set to reach the bug.

    Link: http://lkml.kernel.org/r/20180328114815.GC29050@mwanda

    Fixes: 30350d65ac56 ("tracing: Add variable support to hist triggers")
    Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    ---
    kernel/trace/trace_events_hist.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
    index 15ea11c29a51..0d7b3ffbecc2 100644
    --- a/kernel/trace/trace_events_hist.c
    +++ b/kernel/trace/trace_events_hist.c
    @@ -4458,7 +4458,7 @@ static int create_tracing_map_fields(struct hist_trigger_data *hist_data)
    struct tracing_map *map = hist_data->map;
    struct ftrace_event_field *field;
    struct hist_field *hist_field;
    - int i, idx;
    + int i, idx = 0;

    for_each_hist_field(i, hist_data) {
    hist_field = hist_data->fields[i];
    --
    2.15.1

    \
     
     \ /
      Last update: 2018-04-06 15:05    [W:3.790 / U:0.940 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site