lkml.org 
[lkml]   [2009]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] perf tools: Shut up compiler warning

    * Arnaldo Carvalho de Melo <acme@redhat.com> wrote:

    > cc1: warnings being treated as errors
    > util/trace-event-parse.c: In function ‘parse_ftrace_printk’:
    > util/trace-event-parse.c:289: warning: ‘fmt’ may be used uninitialized in this function
    >
    > Cc: Steven Rostedt <srostedt@redhat.com>
    > Cc: Peter Zijlstra <peterz@infradead.org>
    > Cc: Frederic Weisbecker <fweisbec@gmail.com>
    > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    > ---
    > tools/perf/util/trace-event-parse.c | 2 +-
    > 1 files changed, 1 insertions(+), 1 deletions(-)
    >
    > diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
    > index 4b61b49..0b8a01b 100644
    > --- a/tools/perf/util/trace-event-parse.c
    > +++ b/tools/perf/util/trace-event-parse.c
    > @@ -286,7 +286,7 @@ void parse_ftrace_printk(char *file, unsigned int size __unused)
    > char *line;
    > char *next = NULL;
    > char *addr_str;
    > - char *fmt;
    > + char *fmt = NULL;
    > int i;
    >
    > line = strtok_r(file, "\n", &next);

    Actually, this might be a real bug that GCC pointed out: what makes sure
    that strtok_r() does not return a NULL (no more tokens) and hence fmt
    remains NULL (crashing the rest of the parser)?

    Ingo
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2009-10-20 07:57    [W:0.027 / U:0.780 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site