Re: [PATCH 4/6] perf kmem: Print gfp flags in human readable string

From: Arnaldo Carvalho de Melo
Date: Mon May 11 2015 - 10:35:46 EST


Em Tue, Apr 21, 2015 at 01:55:05PM +0900, Namhyung Kim escreveu:
> Save libtraceevent output and print it in the header.

<SNIP>

> +static int parse_gfp_flags(struct perf_evsel *evsel, struct perf_sample *sample,
> + unsigned int gfp_flags)
> +{
> + struct pevent_record record = {
> + .cpu = sample->cpu,
> + .data = sample->raw_data,
> + .size = sample->raw_size,
> + };
> + struct trace_seq seq;
> + char *str, *pos;
> +
> + if (nr_gfps) {
> + struct gfp_flag key = {
> + .flags = gfp_flags,
> + };
> +
> + if (bsearch(&key, gfps, nr_gfps, sizeof(*gfps), gfpcmp))
> + return 0;
> + }
> +
> + trace_seq_init(&seq);
> + pevent_event_info(&seq, evsel->tp_format, &record);
> +
> + str = strtok_r(seq.buffer, " ", &pos);


This introduced a problem I only now noticed, possibly because my
compiler was upgraded:

[acme@zoo linux]$ git bisect good
0e11115644b39ff9e986eb308b6c44ca75cd475f is the first bad commit
commit 0e11115644b39ff9e986eb308b6c44ca75cd475f
Author: Namhyung Kim <namhyung@xxxxxxxxxx>
Date: Tue Apr 21 13:55:05 2015 +0900

perf kmem: Print gfp flags in human readable string

Save libtraceevent output and print it in the header.

-------------------------------------------------


GEN /tmp/build/perf/common-cmds.h
PERF_VERSION = 4.1.rc2.ga20d87
CC /tmp/build/perf/builtin-kmem.o
builtin-kmem.c: In function âperf_evsel__process_page_alloc_eventâ:
builtin-kmem.c:743:427: error: âposâ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
new->human_readable = strdup(str + 10);
^
builtin-kmem.c:716:14: note: âposâ was declared here
char *str, *pos;
^
cc1: all warnings being treated as errors
/home/git/linux/tools/build/Makefile.build:68: recipe for target
'/tmp/build/perf/builtin-kmem.o' failed
make[2]: *** [/tmp/build/perf/builtin-kmem.o] Error 1
Makefile.perf:330: recipe for target '/tmp/build/perf/builtin-kmem.o'
failed
make[1]: *** [/tmp/build/perf/builtin-kmem.o] Error 2
Makefile:87: recipe for target 'builtin-kmem.o' failed
make: *** [builtin-kmem.o] Error 2
make: Leaving directory '/home/git/linux/tools/perf'

------

Trying to fix it by initializing it to NULL.

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