linux-yocto/tools
hupu 1773f674c4 perf subcmd: avoid crash in exclude_cmds when excludes is empty
[ Upstream commit a5edf3550f4260504b7e0ab3d40d13ffe924b773 ]

When cross-compiling the perf tool for ARM64, `perf help` may crash
with the following assertion failure:

  help.c:122: exclude_cmds: Assertion `cmds->names[ci] == NULL' failed.

This happens when the perf binary is not named exactly "perf" or when
multiple "perf-*" binaries exist in the same directory. In such cases,
the `excludes` command list can be empty, which leads to the final
assertion in exclude_cmds() being triggered.

Add a simple guard at the beginning of exclude_cmds() to return early
if excludes->cnt is zero, preventing the crash.

Signed-off-by: hupu <hupu.gm@gmail.com>
Reported-by: Guilherme Amadio <amadio@gentoo.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20250909094953.106706-1-amadio@gentoo.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-10-12 12:57:16 +02:00
..
accounting
arch objtool/LoongArch: Mark special atomic instruction as INSN_BUG type 2025-09-25 11:13:45 +02:00
bootconfig
bpf bpftool: Fix JSON writer resource leak in version command 2025-08-20 18:30:38 +02:00
build tools/build: Don't pass test log files to linker 2025-05-29 11:02:08 +02:00
certs
cgroup memcg_slabinfo: Fix use of PG_slab 2025-08-15 12:13:46 +02:00
counter
crypto
debugging
firewire
firmware
gpio tools: gpio: remove the include directory on make clean 2025-09-09 18:58:25 +02:00
hv tools/hv: fcopy: Fix irregularities with size of ring buffer 2025-08-20 18:30:56 +02:00
iio
include tools/nolibc: fix spelling of FD_SETBITMASK in FD_* macros 2025-08-20 18:30:56 +02:00
kvm/kvm_stat
laptop
leds
lib perf subcmd: avoid crash in exclude_cmds when excludes is empty 2025-10-12 12:57:16 +02:00
memory-model
mm
net tools: ynl-gen: validate 0 len strings from kernel 2025-05-29 11:03:12 +02:00
objtool objtool/LoongArch: Mark special atomic instruction as INSN_BUG type 2025-09-25 11:13:45 +02:00
pci
pcmcia
perf perf bpf-utils: Harden get_bpf_prog_info_linear 2025-09-09 18:58:25 +02:00
power cpupower: Fix a bug where the -t option of the set subcommand was not working. 2025-09-09 18:58:02 +02:00
rcu
sched_ext tools/sched_ext: Add helper to check task migration state 2025-03-22 12:54:28 -07:00
scripts tools/build: Fix s390(x) cross-compilation with clang 2025-08-20 18:30:24 +02:00
sound ASoC: dapm-graph: set fill colour of turned on nodes 2025-03-22 12:54:20 -07:00
spi
testing selftests: fib_nexthops: Fix creation of non-FDB nexthops 2025-10-02 13:44:10 +02:00
thermal
time
tracing rtla: Check pkg-config install 2025-09-04 15:31:42 +02:00
usb
verification tools/rv: Do not skip idle in trace 2025-08-15 12:13:46 +02:00
virtio
wmi
workqueue
writeback
Makefile