linux-yocto/tools
hupu 081f14b9a3 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:56:21 +02:00
..
accounting
arch x86/rdrand: Disable RDSEED on AMD Cyan Skillfish 2025-07-17 18:35:15 +02:00
bootconfig tools/bootconfig: Fix the wrong format specifier 2025-02-08 09:52:28 +01:00
bpf bpftool: Fix JSON writer resource leak in version command 2025-08-28 16:28:24 +02:00
build perf: build: Setup PKG_CONFIG_LIBDIR for cross compilation 2025-07-17 18:35:11 +02:00
certs
cgroup
counter
crypto/ccp
debugging
edid
firewire
firmware
gpio tools: gpio: remove the include directory on make clean 2025-09-09 18:56:34 +02:00
hv tools: hv: change permissions of NetworkManager configuration file 2024-12-27 13:58:46 +01:00
iio tools/iio: Add memory allocation failure check for trigger_name 2024-10-17 15:24:20 +02:00
include bonding: Add independent control state machine 2025-08-28 16:28:49 +02:00
kvm/kvm_stat
laptop
leds
lib perf subcmd: avoid crash in exclude_cmds when excludes is empty 2025-10-12 12:56:21 +02:00
memory-model
mm tools/mm: fix compile error 2024-11-22 15:38:33 +01:00
net/ynl tools: ynl-gen: validate 0 len strings from kernel 2025-06-04 14:42:16 +02:00
objtool objtool: Fix error handling inconsistencies in check() 2025-06-04 14:41:58 +02:00
pci
pcmcia
perf perf bpf-event: Fix use-after-free in synthesis 2025-09-09 18:56:33 +02:00
power cpupower: Fix a bug where the -t option of the set subcommand was not working. 2025-09-09 18:56:20 +02:00
rcu
scripts tools/build: Fix s390(x) cross-compilation with clang 2025-08-28 16:28:17 +02:00
spi
testing minmax: make generic MIN() and MAX() macros available everywhere 2025-10-02 13:42:55 +02:00
thermal
time
tracing rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads 2025-03-07 16:45:49 +01:00
usb usbip: tools: Fix detach_port() invalid port error path 2024-11-08 16:28:22 +01:00
verification tools/rv: Do not skip idle in trace 2025-08-15 12:08:49 +02:00
virtio
wmi
workqueue
Makefile