diff options
author | Namhyung Kim <namhyung@kernel.org> | 2025-06-27 09:38:56 -0700 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2025-06-27 11:45:48 -0700 |
commit | ef0f7c235e5c2195ff61a2c9a5b9efb2375ce433 (patch) | |
tree | 044391cf5f48d50501a5dd1b62383e764ed0a78b | |
parent | 9d8511daf1e81a93007b7bb5020d4ce5ce001deb (diff) |
perf build: Fix a build error on REFCNT_CHECKING=1
Recently it added -fno-strict-aliasing to sync with the kernel behavior.
But it caused an error due to potential uninitialized access like below:
In file included from util/symbol.c:27:
In function ‘dso__set_symbol_names_len’,
inlined from ‘dso__sort_by_name’ at util/symbol.c:638:4:
util/dso.h:654:46: error: ‘len’ may be used uninitialized [-Werror=maybe-uninitialized]
654 | RC_CHK_ACCESS(dso)->symbol_names_len = len;
| ^
util/symbol.c: In function ‘dso__sort_by_name’:
util/symbol.c:634:24: note: ‘len’ was declared here
634 | size_t len;
| ^~~
Let's just initialize it with 0.
Fixes: 55a18d2f3ff79c90 ("perf build: enable -fno-strict-aliasing")
Closes: https://lore.kernel.org/r/aF7JC8zkG5-_-nY_@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-rw-r--r-- | tools/perf/util/symbol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 8b30c6f16a9e..73dab94fab74 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -631,7 +631,7 @@ void dso__sort_by_name(struct dso *dso) { mutex_lock(dso__lock(dso)); if (!dso__sorted_by_name(dso)) { - size_t len; + size_t len = 0; dso__set_symbol_names(dso, symbols__sort_by_name(dso__symbols(dso), &len)); if (dso__symbol_names(dso)) { |