perf annotate: Fix multiple memory and file descriptor leaks
PATCH 1/1 perf annotate: Fix multiple memory and file descriptor leaks
Store SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF in variable *ret*, instead of returning in the middle of the function and leaking multiple
resources: prog_linfo, btf, s and bfdf.
Addresses-Coverity-ID: 1454832 ("Structurally dead code")
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
@@ -1758,7 +1758,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, info_node =perf_env__find_bpf_prog_info (dso->bpf_prog.env, dso->bpf_prog.id);if (!info_node) { -return SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; + ret =SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; goto out; } info_linear = info_node->info_linear;
Signature · 1 line
2.23.0
Quoted 7 lines · Gustavo A. R. Silva
Store
SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTFin variable *ret*, instead of returning in the middle of the function and leaking multiple
resources:prog_linfo, btf, s and bfdf.Addresses-Coverity-ID: 1454832 ("Structurally dead code")
Fixes 11aad897f6d1 ("perf annotate: Don't return -1 for error when doing BPF disassembly")Signed-off-by Gustavo A. R. Silva <[email protected]>
thanks,
jirka
Quoted 20 lines
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/annotate.c +1
-1@@ -1758,7 +1758,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, info_node =perf_env__find_bpf_prog_info (dso->bpf_prog.env, dso->bpf_prog.id);if (!info_node) { -return SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; + ret =SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; goto out; } info_linear = info_node->info_linear;Signature · 1 line
2.23.0
Em Tue, Oct 15, 2019 at 10:46:32AM +0200, Jiri Olsa escreveu:
Quoted 18 lines · Gustavo A. R. Silva
Quoted 7 lines
Store
SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTFin variable *ret*, instead of returning in the middle of the function and leaking multiple
resources:prog_linfo, btf, s and bfdf.Addresses-Coverity-ID: 1454832 ("Structurally dead code")
Fixes 11aad897f6d1 ("perf annotate: Don't return -1 for error when doing BPF disassembly")Signed-off-by Gustavo A. R. Silva <[email protected]>Acked-by Jiri Olsa <[email protected]>thanks,
jirkaQuoted 4 lines
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines
tools/perf/util/annotate.c static int symbol__disassemble_bpf(struct symbol *sym, · line 1762
Quoted 11 lines
tools/perf/util/annotate.c +1
-1@@ -1758,7 +1758,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, info_node =perf_env__find_bpf_prog_info (dso->bpf_prog.env, dso->bpf_prog.id);if (!info_node) { -return SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; + ret =SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; goto out;
Ouch, unreachable goto, /me ducks
- Arnaldo
Quoted 5 lines
Quoted 5 lines
tools/perf/util/annotate.c +0
-0} info_linear = info_node->info_linear;Signature · 1 line
2.23.0
Signature · 1 line
- Arnaldo
The following commit has been merged into the perf/urgent branch of tip:
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: f948eb45e3af9fb18a0487d0797a773897ef6929 Gitweb: https://git.kernel.org/tip/f948eb45e3af9fb18a0487d0797a773897ef6929 Author: Gustavo A. R. Silva <[email protected]> AuthorDate: Mon, 14 Oct 2019 12:10:47 -05:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Tue, 15 Oct 2019 12:00:01 -03:00
perf annotate: Fix multiple memory and file descriptor leaks
Store SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF in variable *ret*, instead of returning in the middle of the function and leaking multiple
resources: prog_linfo, btf, s and bfdf.
Addresses-Coverity-ID: 1454832 ("Structurally dead code")
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
@@ -1758,7 +1758,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, info_node =perf_env__find_bpf_prog_info (dso->bpf_prog.env, dso->bpf_prog.id);if (!info_node) { -return SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; + ret =SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; goto out; } info_linear = info_node->info_linear;