From 9fbde6c8002bce61acd0c2187cc41c43a7c99968 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 12 Apr 2023 09:50:08 -0300 Subject: perf env: Use zfree() to reduce chances of use after free Do defensive programming by using zfree() to initialize freed pointers to NULL, so that eventual use after free result in a NULL pointer deref instead of more subtle behaviour. Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/perf/util/env.c') diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 5b8cf6a421a4..ebf2e801c275 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -149,7 +149,7 @@ static void perf_env__purge_bpf(struct perf_env *env) node = rb_entry(next, struct bpf_prog_info_node, rb_node); next = rb_next(&node->rb_node); rb_erase(&node->rb_node, root); - free(node->info_linear); + zfree(&node->info_linear); free(node); } -- cgit From 2fa5ebe3bc4e31e07a99196455498472417842f2 Mon Sep 17 00:00:00 2001 From: Huacai Chen Date: Mon, 1 May 2023 17:19:59 +0800 Subject: tools/perf: Add basic support for LoongArch Add basic support for LoongArch, which is very similar to the MIPS version. Signed-off-by: Ming Wang Signed-off-by: Huacai Chen --- tools/perf/util/env.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/perf/util/env.c') diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 5b8cf6a421a4..0d5d40cb997b 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -435,6 +435,8 @@ static const char *normalize_arch(char *arch) return "mips"; if (!strncmp(arch, "sh", 2) && isdigit(arch[2])) return "sh"; + if (!strncmp(arch, "loongarch", 9)) + return "loongarch"; return arch; } -- cgit