* [PATCH] perf unwind: fix unitialized offset on aarch64
@ 2022-07-01 18:20 Ivan Babrou
2022-07-02 12:18 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 2+ messages in thread
From: Ivan Babrou @ 2022-07-01 18:20 UTC (permalink / raw)
To: linux-perf-users
Cc: linux-kernel, kernel-team, Ivan Babrou, Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Namhyung Kim, James Clark,
Ian Rogers, Fangrui Song
Commit dc2cf4ca866f uncovered the following issue on aarch64:
util/unwind-libunwind-local.c: In function 'find_proc_info':
util/unwind-libunwind-local.c:386:28: error: 'offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
386 | if (ofs > 0) {
| ^
util/unwind-libunwind-local.c:199:22: note: 'offset' was declared here
199 | u64 address, offset;
| ^~~~~~
util/unwind-libunwind-local.c:371:20: error: 'offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
371 | if (ofs <= 0) {
| ^
util/unwind-libunwind-local.c:199:22: note: 'offset' was declared here
199 | u64 address, offset;
| ^~~~~~
util/unwind-libunwind-local.c:363:20: error: 'offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
363 | if (ofs <= 0) {
| ^
util/unwind-libunwind-local.c:199:22: note: 'offset' was declared here
199 | u64 address, offset;
| ^~~~~~
In file included from util/libunwind/arm64.c:37:
Signed-off-by: Ivan Babrou <ivan@cloudflare.com>
Fixes: dc2cf4ca866f
---
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..eaa8fa4b34f3 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -197,7 +197,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address
#ifndef NO_LIBUNWIND_DEBUG_FRAME
static u64 elf_section_offset(int fd, const char *name)
{
- u64 address, offset;
+ u64 address, offset = 0;
if (elf_section_address_and_offset(fd, name, &address, &offset))
return 0;
--
2.36.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] perf unwind: fix unitialized offset on aarch64
2022-07-01 18:20 [PATCH] perf unwind: fix unitialized offset on aarch64 Ivan Babrou
@ 2022-07-02 12:18 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-07-02 12:18 UTC (permalink / raw)
To: Ivan Babrou
Cc: linux-perf-users, linux-kernel, kernel-team, Peter Zijlstra,
Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, James Clark, Ian Rogers, Fangrui Song
Em Fri, Jul 01, 2022 at 11:20:46AM -0700, Ivan Babrou escreveu:
> Commit dc2cf4ca866f uncovered the following issue on aarch64:
>
> util/unwind-libunwind-local.c: In function 'find_proc_info':
> util/unwind-libunwind-local.c:386:28: error: 'offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 386 | if (ofs > 0) {
> | ^
> util/unwind-libunwind-local.c:199:22: note: 'offset' was declared here
> 199 | u64 address, offset;
> | ^~~~~~
> util/unwind-libunwind-local.c:371:20: error: 'offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 371 | if (ofs <= 0) {
> | ^
> util/unwind-libunwind-local.c:199:22: note: 'offset' was declared here
> 199 | u64 address, offset;
> | ^~~~~~
> util/unwind-libunwind-local.c:363:20: error: 'offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 363 | if (ofs <= 0) {
> | ^
> util/unwind-libunwind-local.c:199:22: note: 'offset' was declared here
> 199 | u64 address, offset;
> | ^~~~~~
> In file included from util/libunwind/arm64.c:37:
Thanks, applied.
- Arnaldo
> Signed-off-by: Ivan Babrou <ivan@cloudflare.com>
> Fixes: dc2cf4ca866f
> ---
> 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..eaa8fa4b34f3 100644
> --- a/tools/perf/util/unwind-libunwind-local.c
> +++ b/tools/perf/util/unwind-libunwind-local.c
> @@ -197,7 +197,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address
> #ifndef NO_LIBUNWIND_DEBUG_FRAME
> static u64 elf_section_offset(int fd, const char *name)
> {
> - u64 address, offset;
> + u64 address, offset = 0;
>
> if (elf_section_address_and_offset(fd, name, &address, &offset))
> return 0;
> --
> 2.36.1
--
- Arnaldo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-02 12:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-01 18:20 [PATCH] perf unwind: fix unitialized offset on aarch64 Ivan Babrou
2022-07-02 12:18 ` Arnaldo Carvalho de Melo
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).