linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf annotate: Fix multiple memory and file descriptor leaks
@ 2019-10-14 17:10 Gustavo A. R. Silva
  2019-10-15  8:46 ` Jiri Olsa
  2019-10-21  6:26 ` [tip: perf/urgent] " tip-bot2 for Gustavo A. R. Silva
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-10-14 17:10 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim
  Cc: linux-kernel, Gustavo A. R. Silva

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")
Fixes: 11aad897f6d1 ("perf annotate: Don't return -1 for error when doing BPF disassembly")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 4036c7f7b0fb..e42bf572358c 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -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;
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf annotate: Fix multiple memory and file descriptor leaks
  2019-10-14 17:10 [PATCH] perf annotate: Fix multiple memory and file descriptor leaks Gustavo A. R. Silva
@ 2019-10-15  8:46 ` Jiri Olsa
  2019-10-15 15:02   ` Arnaldo Carvalho de Melo
  2019-10-21  6:26 ` [tip: perf/urgent] " tip-bot2 for Gustavo A. R. Silva
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2019-10-15  8:46 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Namhyung Kim, linux-kernel

On Mon, Oct 14, 2019 at 12:10:47PM -0500, Gustavo A. R. Silva wrote:
> 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")
> Fixes: 11aad897f6d1 ("perf annotate: Don't return -1 for error when doing BPF disassembly")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> ---
>  tools/perf/util/annotate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 4036c7f7b0fb..e42bf572358c 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -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;
> -- 
> 2.23.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf annotate: Fix multiple memory and file descriptor leaks
  2019-10-15  8:46 ` Jiri Olsa
@ 2019-10-15 15:02   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-10-15 15:02 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Gustavo A. R. Silva, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Namhyung Kim, linux-kernel

Em Tue, Oct 15, 2019 at 10:46:32AM +0200, Jiri Olsa escreveu:
> On Mon, Oct 14, 2019 at 12:10:47PM -0500, Gustavo A. R. Silva wrote:
> > 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")
> > Fixes: 11aad897f6d1 ("perf annotate: Don't return -1 for error when doing BPF disassembly")
> > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>
> 
> thanks,
> jirka
> 
> > ---
> >  tools/perf/util/annotate.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> > index 4036c7f7b0fb..e42bf572358c 100644
> > --- a/tools/perf/util/annotate.c
> > +++ b/tools/perf/util/annotate.c
> > @@ -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

> >  	}
> >  	info_linear = info_node->info_linear;
> > -- 
> > 2.23.0
> > 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: perf/urgent] perf annotate: Fix multiple memory and file descriptor leaks
  2019-10-14 17:10 [PATCH] perf annotate: Fix multiple memory and file descriptor leaks Gustavo A. R. Silva
  2019-10-15  8:46 ` Jiri Olsa
@ 2019-10-21  6:26 ` tip-bot2 for Gustavo A. R. Silva
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Gustavo A. R. Silva @ 2019-10-21  6:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Gustavo A. R. Silva, Jiri Olsa, Alexander Shishkin, Mark Rutland,
	Namhyung Kim, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Ingo Molnar, Borislav Petkov, linux-kernel

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 <gustavo@embeddedor.com>
AuthorDate:    Mon, 14 Oct 2019 12:10:47 -05:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
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")
Fixes: 11aad897f6d1 ("perf annotate: Don't return -1 for error when doing BPF disassembly")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20191014171047.GA30850@embeddedor
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 4036c7f..e42bf57 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-21  6:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 17:10 [PATCH] perf annotate: Fix multiple memory and file descriptor leaks Gustavo A. R. Silva
2019-10-15  8:46 ` Jiri Olsa
2019-10-15 15:02   ` Arnaldo Carvalho de Melo
2019-10-21  6:26 ` [tip: perf/urgent] " tip-bot2 for Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).