Skip to content

Commit

Permalink
perf c2c: Keep struct hist_entry at the end of struct c2c_hist_entry
Browse files Browse the repository at this point in the history
Exactly as the comment just before 'struct c2c_hist_entry" says, i.e.
the last entry in struct hist_entry is a zero length array, that when
allocating space for hist_entry gets extra space if callchains are in
use, which, if hist_entry is not at the end of c2c_hist_entry, the
members after it gets corrupted when callchains get added to the rb
trees collecting them, etc.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jin Yao <yao.jin@linux.intel.com>
Fixes: 7f834c2 ("perf c2c report: Display node for cacheline address")
Link: http://lkml.kernel.org/n/tip-bh0ke4fh2ygpj3yowna7o1di@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Jun 8, 2018
1 parent a5cfa62 commit 4c82052
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/perf/builtin-c2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ struct c2c_hist_entry {

struct compute_stats cstats;

unsigned long paddr;
unsigned long paddr_cnt;
bool paddr_zero;
char *nodestr;

/*
* must be at the end,
* because of its callchain dynamic entry
*/
struct hist_entry he;

unsigned long paddr;
unsigned long paddr_cnt;
bool paddr_zero;
char *nodestr;
};

static char const *coalesce_default = "pid,iaddr";
Expand Down

0 comments on commit 4c82052

Please sign in to comment.