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;
>  

Reply via email to