diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2025-03-10 16:45:33 -0300 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2025-03-13 00:30:14 -0700 |
commit | 2333cfa9f80464ba797a7d4c53886278ffe82cb9 (patch) | |
tree | e31c8c73c693bcb1e55429b9861a76de75e6c70f /tools/perf/util/trace-event-scripting.c | |
parent | cf67629f7f637fb988228abdb3aae46d0c1748fe (diff) | |
download | lwn-2333cfa9f80464ba797a7d4c53886278ffe82cb9.tar.gz lwn-2333cfa9f80464ba797a7d4c53886278ffe82cb9.zip |
perf hist stdio: Do bounds check when printing callchains to avoid UB with new gcc versions
Do a simple bounds check to avoid this on new gcc versions:
31 15.81 fedora:rawhide : FAIL gcc version 15.0.1 20250225 (Red Hat 15.0.1-0) (GCC)
In function 'callchain__fprintf_left_margin',
inlined from 'callchain__fprintf_graph.constprop' at ui/stdio/hist.c:246:12:
ui/stdio/hist.c:27:39: error: iteration 2147483647 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
27 | for (i = 0; i < left_margin; i++)
| ~^~
ui/stdio/hist.c:27:23: note: within this loop
27 | for (i = 0; i < left_margin; i++)
| ~~^~~~~~~~~~~~~
cc1: all warnings being treated as errors
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20250310194534.265487-4-acme@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions