Skip to content

Commit

Permalink
perf_counter tools: Initialize a stack variable before use
Browse files Browse the repository at this point in the history
the "perf report" utility crashed in some circumstances
because the "sym" stack variable was not initialized before used
(as also proven by valgrind).

With this fix both the crash goes away and valgrind no longer complains.

Signed-off-by: Arjan van de Ven <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
fenrus75 authored and Ingo Molnar committed Jun 6, 2009
1 parent 39273ee commit e9fbc9d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,

nr_syms = shdr.sh_size / shdr.sh_entsize;

memset(&sym, 0, sizeof(sym));

elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
struct symbol *f;
uint64_t obj_start;
Expand Down

0 comments on commit e9fbc9d

Please sign in to comment.