public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] perf unwind: Fix uninitialized variable
@ 2022-06-07  0:08 Ian Rogers
  2022-06-07  0:26 ` Fangrui Song
  2022-06-07 18:12 ` Sedat Dilek
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Rogers @ 2022-06-07  0:08 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	linux-perf-users, linux-kernel, Sedat Dilek
  Cc: Ian Rogers, llvm, Fangrui Song, Sebastian Ullrich

ret may be uninitialized on error goto paths.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Fixes: dc2cf4ca866f ("perf unwind: Fix segbase for ld.lld linked objects")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/unwind-libunwind-local.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index 37622699c91a..6e5b8cce47bf 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -174,7 +174,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address
 	Elf *elf;
 	GElf_Ehdr ehdr;
 	GElf_Shdr shdr;
-	int ret;
+	int ret = -1;
 
 	elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
 	if (elf == NULL)
-- 
2.36.1.255.ge46751e96f-goog


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

* Re: [PATCH] perf unwind: Fix uninitialized variable
  2022-06-07  0:08 [PATCH] perf unwind: Fix uninitialized variable Ian Rogers
@ 2022-06-07  0:26 ` Fangrui Song
  2022-06-09 16:34   ` Arnaldo Carvalho de Melo
  2022-06-07 18:12 ` Sedat Dilek
  1 sibling, 1 reply; 5+ messages in thread
From: Fangrui Song @ 2022-06-07  0:26 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	linux-perf-users, linux-kernel, Sedat Dilek, llvm,
	Sebastian Ullrich

On 2022-06-06, Ian Rogers wrote:
>ret may be uninitialized on error goto paths.
>
>Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
>Fixes: dc2cf4ca866f ("perf unwind: Fix segbase for ld.lld linked objects")
>Signed-off-by: Ian Rogers <irogers@google.com>

Thanks. Sorry for my mistake...

Reviewed-by: Fangrui Song <maskray@google.com>

>---
> tools/perf/util/unwind-libunwind-local.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
>index 37622699c91a..6e5b8cce47bf 100644
>--- a/tools/perf/util/unwind-libunwind-local.c
>+++ b/tools/perf/util/unwind-libunwind-local.c
>@@ -174,7 +174,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address
> 	Elf *elf;
> 	GElf_Ehdr ehdr;
> 	GElf_Shdr shdr;
>-	int ret;
>+	int ret = -1;
>
> 	elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
> 	if (elf == NULL)
>-- 
>2.36.1.255.ge46751e96f-goog
>

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

* Re: [PATCH] perf unwind: Fix uninitialized variable
  2022-06-07  0:08 [PATCH] perf unwind: Fix uninitialized variable Ian Rogers
  2022-06-07  0:26 ` Fangrui Song
@ 2022-06-07 18:12 ` Sedat Dilek
  2022-06-08 19:29   ` Sedat Dilek
  1 sibling, 1 reply; 5+ messages in thread
From: Sedat Dilek @ 2022-06-07 18:12 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	linux-perf-users, linux-kernel, llvm, Fangrui Song,
	Sebastian Ullrich

On Tue, Jun 7, 2022 at 2:09 AM Ian Rogers <irogers@google.com> wrote:
>
> ret may be uninitialized on error goto paths.
>
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Fixes: dc2cf4ca866f ("perf unwind: Fix segbase for ld.lld linked objects")
> Signed-off-by: Ian Rogers <irogers@google.com>

Thanks for the patch.

Feel free to add my:

Tested-by: Sedat Dilek <sedat.dilek@gmail.com>

$ LC_ALL=C ll ~/bin/perf
-rwxr-xr-x 2 dileks dileks 16M Jun  7 20:10 /home/dileks/bin/perf

$ ~/bin/perf -vv
perf version 5.19.0-rc1
                dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
   dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
        syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
               libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
           debuginfod: [ OFF ]  # HAVE_DEBUGINFOD_SUPPORT
               libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
              libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
              libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
            libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
             libslang: [ on  ]  # HAVE_SLANG_SUPPORT
            libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
            libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
   libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                 zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                 lzma: [ on  ]  # HAVE_LZMA_SUPPORT
            get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                  bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
                  aio: [ on  ]  # HAVE_AIO_SUPPORT
                 zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
              libpfm4: [ OFF ]  # HAVE_LIBPFM

-Sedat-

> ---
>  tools/perf/util/unwind-libunwind-local.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
> index 37622699c91a..6e5b8cce47bf 100644
> --- a/tools/perf/util/unwind-libunwind-local.c
> +++ b/tools/perf/util/unwind-libunwind-local.c
> @@ -174,7 +174,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address
>         Elf *elf;
>         GElf_Ehdr ehdr;
>         GElf_Shdr shdr;
> -       int ret;
> +       int ret = -1;
>
>         elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
>         if (elf == NULL)
> --
> 2.36.1.255.ge46751e96f-goog
>

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

* Re: [PATCH] perf unwind: Fix uninitialized variable
  2022-06-07 18:12 ` Sedat Dilek
@ 2022-06-08 19:29   ` Sedat Dilek
  0 siblings, 0 replies; 5+ messages in thread
From: Sedat Dilek @ 2022-06-08 19:29 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	linux-perf-users, linux-kernel, llvm, Fangrui Song,
	Sebastian Ullrich

On Tue, Jun 7, 2022 at 8:12 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Tue, Jun 7, 2022 at 2:09 AM Ian Rogers <irogers@google.com> wrote:
> >
> > ret may be uninitialized on error goto paths.
> >
> > Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> > Fixes: dc2cf4ca866f ("perf unwind: Fix segbase for ld.lld linked objects")
> > Signed-off-by: Ian Rogers <irogers@google.com>
>
> Thanks for the patch.
>
> Feel free to add my:
>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
>

If it is not too late, more exactly:

Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64)

-Sedat-

> $ LC_ALL=C ll ~/bin/perf
> -rwxr-xr-x 2 dileks dileks 16M Jun  7 20:10 /home/dileks/bin/perf
>
> $ ~/bin/perf -vv
> perf version 5.19.0-rc1
>                 dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
>    dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
>                 glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
>         syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
>                libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
>            debuginfod: [ OFF ]  # HAVE_DEBUGINFOD_SUPPORT
>                libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
>               libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
>               libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
>             libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
>              libslang: [ on  ]  # HAVE_SLANG_SUPPORT
>             libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
>             libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
>    libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
>                  zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
>                  lzma: [ on  ]  # HAVE_LZMA_SUPPORT
>             get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
>                   bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
>                   aio: [ on  ]  # HAVE_AIO_SUPPORT
>                  zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
>               libpfm4: [ OFF ]  # HAVE_LIBPFM
>
> -Sedat-
>
> > ---
> >  tools/perf/util/unwind-libunwind-local.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
> > index 37622699c91a..6e5b8cce47bf 100644
> > --- a/tools/perf/util/unwind-libunwind-local.c
> > +++ b/tools/perf/util/unwind-libunwind-local.c
> > @@ -174,7 +174,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address
> >         Elf *elf;
> >         GElf_Ehdr ehdr;
> >         GElf_Shdr shdr;
> > -       int ret;
> > +       int ret = -1;
> >
> >         elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
> >         if (elf == NULL)
> > --
> > 2.36.1.255.ge46751e96f-goog
> >

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

* Re: [PATCH] perf unwind: Fix uninitialized variable
  2022-06-07  0:26 ` Fangrui Song
@ 2022-06-09 16:34   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-06-09 16:34 UTC (permalink / raw)
  To: Fangrui Song
  Cc: Ian Rogers, Peter Zijlstra, Ingo Molnar, linux-perf-users,
	linux-kernel, Sedat Dilek, llvm, Sebastian Ullrich

Em Mon, Jun 06, 2022 at 05:26:58PM -0700, Fangrui Song escreveu:
> On 2022-06-06, Ian Rogers wrote:
> > ret may be uninitialized on error goto paths.
> > 
> > Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> > Fixes: dc2cf4ca866f ("perf unwind: Fix segbase for ld.lld linked objects")
> > Signed-off-by: Ian Rogers <irogers@google.com>
> 
> Thanks. Sorry for my mistake...
> 
> Reviewed-by: Fangrui Song <maskray@google.com>

Thanks, applied.

- Arnaldo

 
> > ---
> > tools/perf/util/unwind-libunwind-local.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
> > index 37622699c91a..6e5b8cce47bf 100644
> > --- a/tools/perf/util/unwind-libunwind-local.c
> > +++ b/tools/perf/util/unwind-libunwind-local.c
> > @@ -174,7 +174,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address
> > 	Elf *elf;
> > 	GElf_Ehdr ehdr;
> > 	GElf_Shdr shdr;
> > -	int ret;
> > +	int ret = -1;
> > 
> > 	elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
> > 	if (elf == NULL)
> > -- 
> > 2.36.1.255.ge46751e96f-goog
> > 

-- 

- Arnaldo

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

end of thread, other threads:[~2022-06-09 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-07  0:08 [PATCH] perf unwind: Fix uninitialized variable Ian Rogers
2022-06-07  0:26 ` Fangrui Song
2022-06-09 16:34   ` Arnaldo Carvalho de Melo
2022-06-07 18:12 ` Sedat Dilek
2022-06-08 19:29   ` Sedat Dilek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox