diff options
author | Ian Rogers <[email protected]> | 2023-07-24 13:12:45 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2023-07-24 18:23:52 -0300 |
commit | 0f97a3a0deccece93797cd35ba1c18704e94b7e7 (patch) | |
tree | 1780798b51931a14fb1c9ec465b8b7516a450905 | |
parent | 91f88a0ac8bce5f385ef8c1a6766fce04f7f0043 (diff) |
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 <[email protected]>
Signed-off-by: Ian Rogers <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Carsten Haitzler <[email protected]>
Cc: Fangrui Song <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: Tom Rix <[email protected]>
Cc: Xing Zhengjun <[email protected]>
Cc: Yang Jihong <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-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; |