From: Namhyung Kim Date: Mon, 14 Dec 2015 03:11:13 +0000 (+0900) Subject: perf test: Fix hist testcases when kptr_restrict is on X-Git-Tag: v4.14-rc1~4090^2~19^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71d6de64feddd4b455555326fba2111b3006d9e0;p=platform%2Fkernel%2Flinux-rpi.git perf test: Fix hist testcases when kptr_restrict is on Currently if kptr_restrict is enabled, all hist tests failed with segfaults. This is because machine__create_kernel_maps() in setup_fake_machine() failed in that situation, and it called machine__delete() on the error path. But outer callers again called machines__exit() causing double free for the host machine. Signed-off-by: Namhyung Kim Cc: Jiri Olsa Cc: Adrian Hunter Cc: David Ahern Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1450062673-22312-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c index 46f453b..bcfd081 100644 --- a/tools/perf/tests/hists_common.c +++ b/tools/perf/tests/hists_common.c @@ -88,8 +88,8 @@ struct machine *setup_fake_machine(struct machines *machines) } if (machine__create_kernel_maps(machine)) { - pr_debug("Not enough memory for machine setup\n"); - goto out; + pr_debug("Cannot create kernel maps\n"); + return NULL; } for (i = 0; i < ARRAY_SIZE(fake_threads); i++) { @@ -155,7 +155,6 @@ struct machine *setup_fake_machine(struct machines *machines) out: pr_debug("Not enough memory for machine setup\n"); machine__delete_threads(machine); - machine__delete(machine); return NULL; }