Skip to content

Commit 9ab1f50

Browse files
kliang2acmel
authored andcommitted
perf diff: Add missing hists__init() call at tool start
It also uses hists/hist_entries, hists__init() should be called before creating any evsels. Otherwise no extra space will be allocated per perf_evsel nor this space will be initialized when allocating a new perf_evsel instance, resulting in reads/writes to non allocated space, oops. Fix it. Signed-off-by: Kan Liang <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 3b10ea7 commit 9ab1f50

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/perf/builtin-diff.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,11 @@ static int data_init(int argc, const char **argv)
11421142

11431143
int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
11441144
{
1145+
int ret = hists__init();
1146+
1147+
if (ret < 0)
1148+
return ret;
1149+
11451150
perf_config(perf_default_config, NULL);
11461151

11471152
argc = parse_options(argc, argv, options, diff_usage, 0);

0 commit comments

Comments
 (0)