[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 5 May 2016 20:55:18 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: linux-kernel@...r.kernel.org, Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH perf/core v2 5/8] perf header: Make topology checkers to
check return value of strbuf
Em Sat, Apr 30, 2016 at 12:10:33AM +0900, Masami Hiramatsu escreveu:
> Make topology checkers to check the return value of strbuf
> APIs so that it can detect errors in it.
> }
> @@ -1907,7 +1910,7 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse
> u32 nr, node, i;
> char *str;
> uint64_t mem_total, mem_free;
> - struct strbuf sb;
> + struct strbuf sb = STRBUF_INIT;
Since you're going to call strbuf_init() later, is the above really
needed?
> /* nr nodes */
> ret = readn(fd, &nr, sizeof(nr));
> @@ -1918,7 +1921,8 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse
> nr = bswap_32(nr);
>
> ph->env.nr_numa_nodes = nr;
> - strbuf_init(&sb, 256);
> + if (strbuf_init(&sb, 256) < 0)
> + goto error;
>
Powered by blists - more mailing lists