summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/stackcollapse.py
diff options
context:
space:
mode:
authorWander Lairson Costa <wander@redhat.com>2026-03-09 16:46:28 -0300
committerTomas Glozar <tglozar@redhat.com>2026-03-11 15:29:50 +0100
commit4bf4ef5292b9253d8607c61a875d9f6b14129976 (patch)
tree7165c435255baa56948930f4f12ee4d6386b93e2 /tools/perf/scripts/python/stackcollapse.py
parent48fbcd4db34b5ea9135801ffe4585a22681c0815 (diff)
rtla/trace: Fix write loop in trace_event_save_hist()
The write loop in trace_event_save_hist() does not correctly handle errors from the write() system call. If write() returns -1, this value is added to the loop index, leading to an incorrect memory access on the next iteration and potentially an infinite loop. The loop also fails to handle EINTR. Fix the write loop by introducing proper error handling. The return value of write() is now stored in a ssize_t variable and checked for errors. The loop retries the call if interrupted by a signal and breaks on any other error after logging it with strerror(). Additionally, change the index variable type from int to size_t to match the type used for buffer sizes and by strlen(), improving type safety. Fixes: 761916fd02c2 ("rtla/trace: Save event histogram output to a file") Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260309195040.1019085-16-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions