]> git.ipfire.org Git - thirdparty/linux.git/commit
perf tools: Switch printf("...%s", strerror(errno)) to printf("...%m")
authorIan Rogers <irogers@google.com>
Wed, 19 Nov 2025 23:36:21 +0000 (15:36 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 14 Jan 2026 20:22:50 +0000 (17:22 -0300)
commitbac74dcbd48b5b441e47841fd0fe507c7b0bcbaf
tree1d8cb20beaf77b949ccb149d93f3a7ce1affa80c
parent47d3545faeeb6822f404ddb237985e1824a8bd70
perf tools: Switch printf("...%s", strerror(errno)) to printf("...%m")

strerror() has thread safety issues, strerror_r() requires stack
allocated buffers.

Code in perf has already been using the "%m" formatting flag that is a
widely support glibc extension to print the current errno's description.

Expand the usage of this formatting flag and remove usage of
strerror()/strerror_r().

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Blake Jones <blakejones@google.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Haibo Xu <haibo1.xu@intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Yunseong Kim <ysk@kzalloc.com>
Cc: Zhongqiu Han <quic_zhonhan@quicinc.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
20 files changed:
tools/perf/arch/x86/tests/bp-modify.c
tools/perf/bench/uprobe.c
tools/perf/builtin-daemon.c
tools/perf/builtin-probe.c
tools/perf/builtin-record.c
tools/perf/builtin-stat.c
tools/perf/builtin-trace.c
tools/perf/perf.c
tools/perf/util/bpf-event.c
tools/perf/util/bpf-utils.c
tools/perf/util/bpf_lock_contention.c
tools/perf/util/cap.c
tools/perf/util/data.c
tools/perf/util/dso.c
tools/perf/util/evlist.c
tools/perf/util/evsel.c
tools/perf/util/jitdump.c
tools/perf/util/lzma.c
tools/perf/util/session.c
tools/perf/util/symbol-elf.c