Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'perf-tools-fixes-for-v5.16-2021-12-18' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

- Fix segfaults in 'perf inject' related to usage of unopened files

- The return value of hashmap__new() should be checked using IS_ERR()

* tag 'perf-tools-fixes-for-v5.16-2021-12-18' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
perf inject: Fix segfault due to perf_data__fd() without open
perf inject: Fix segfault due to close without open
perf expr: Fix missing check for return value of hashmap__new()

+14 -4
+9 -4
tools/perf/builtin-inject.c
··· 755 755 return inject->itrace_synth_opts.vm_tm_corr_args ? 0 : -ENOMEM; 756 756 } 757 757 758 + static int output_fd(struct perf_inject *inject) 759 + { 760 + return inject->in_place_update ? -1 : perf_data__fd(&inject->output); 761 + } 762 + 758 763 static int __cmd_inject(struct perf_inject *inject) 759 764 { 760 765 int ret = -EINVAL; 761 766 struct perf_session *session = inject->session; 762 - struct perf_data *data_out = &inject->output; 763 - int fd = inject->in_place_update ? -1 : perf_data__fd(data_out); 767 + int fd = output_fd(inject); 764 768 u64 output_data_offset; 765 769 766 770 signal(SIGINT, sig_handler); ··· 1019 1015 } 1020 1016 1021 1017 inject.session = __perf_session__new(&data, repipe, 1022 - perf_data__fd(&inject.output), 1018 + output_fd(&inject), 1023 1019 &inject.tool); 1024 1020 if (IS_ERR(inject.session)) { 1025 1021 ret = PTR_ERR(inject.session); ··· 1082 1078 zstd_fini(&(inject.session->zstd_data)); 1083 1079 perf_session__delete(inject.session); 1084 1080 out_close_output: 1085 - perf_data__close(&inject.output); 1081 + if (!inject.in_place_update) 1082 + perf_data__close(&inject.output); 1086 1083 free(inject.itrace_synth_opts.vm_tm_corr_args); 1087 1084 return ret; 1088 1085 }
+5
tools/perf/util/expr.c
··· 12 12 #include "expr-bison.h" 13 13 #include "expr-flex.h" 14 14 #include "smt.h" 15 + #include <linux/err.h> 15 16 #include <linux/kernel.h> 16 17 #include <linux/zalloc.h> 17 18 #include <ctype.h> ··· 300 299 return NULL; 301 300 302 301 ctx->ids = hashmap__new(key_hash, key_equal, NULL); 302 + if (IS_ERR(ctx->ids)) { 303 + free(ctx); 304 + return NULL; 305 + } 303 306 ctx->runtime = 0; 304 307 305 308 return ctx;