diff options
author | Ian Rogers <irogers@google.com> | 2023-07-24 13:12:45 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-07-24 18:23:52 -0300 |
commit | 0f97a3a0deccece93797cd35ba1c18704e94b7e7 (patch) | |
tree | 1780798b51931a14fb1c9ec465b8b7516a450905 /tools/perf/util | |
parent | 91f88a0ac8bce5f385ef8c1a6766fce04f7f0043 (diff) | |
download | linux-stable-0f97a3a0deccece93797cd35ba1c18704e94b7e7.tar.gz linux-stable-0f97a3a0deccece93797cd35ba1c18704e94b7e7.tar.bz2 linux-stable-0f97a3a0deccece93797cd35ba1c18704e94b7e7.zip |
perf parse-events: Avoid use uninitialized warning
With GCC LTO a potential use uninitialized is spotted:
```
In function ‘parse_events_config_bpf’,
inlined from ‘parse_events_load_bpf’ at util/parse-events.c:874:8:
util/parse-events.c:792:37: error: ‘error_pos’ may be used uninitialized [-Werror=maybe-uninitialized]
792 | idx = term->err_term + error_pos;
| ^
util/parse-events.c: In function ‘parse_events_load_bpf’:
util/parse-events.c:765:13: note: ‘error_pos’ was declared here
765 | int error_pos;
| ^
```
So initialize at declaration.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Carsten Haitzler <carsten.haitzler@arm.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Tom Rix <trix@redhat.com>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: bpf@vger.kernel.org
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230724201247.748146-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/parse-events.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index acde097e327c..da29061ecf49 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -762,7 +762,7 @@ parse_events_config_bpf(struct parse_events_state *parse_state, struct list_head *head_config) { struct parse_events_term *term; - int error_pos; + int error_pos = 0; if (!head_config || list_empty(head_config)) return 0; |