linux/tools/testing/selftests/bpf/benchs
Jiayuan Chen f85981327a selftests/bpf: Fix incorrect array size calculation
The loop in bench_sockmap_prog_destroy() has two issues:

1. Using 'sizeof(ctx.fds)' as the loop bound results in the number of
   bytes, not the number of file descriptors, causing the loop to iterate
   far more times than intended.

2. The condition 'ctx.fds[0] > 0' incorrectly checks only the first fd for
   all iterations, potentially leaving file descriptors unclosed. Change
   it to 'ctx.fds[i] > 0' to check each fd properly.

These fixes ensure correct cleanup of all file descriptors when the
benchmark exits.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250909124721.191555-1-jiayuan.chen@linux.dev

Closes: https://lore.kernel.org/bpf/aLqfWuRR9R_KTe5e@stanley.mountain/
2025-09-09 09:23:47 -07:00
..
bench_bloom_filter_map.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_bpf_crypto.c selftests: bpf: crypto: add benchmark for crypto functions 2024-04-24 16:01:10 -07:00
bench_bpf_hashmap_full_update.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_bpf_hashmap_lookup.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_bpf_loop.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_count.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_htab_mem.c selftests/bpf: Close the file descriptor to avoid resource leaks 2025-04-22 14:29:58 -07:00
bench_local_storage.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_local_storage_create.c selftests/bpf: Remove second semicolon 2024-03-15 14:53:56 +01:00
bench_local_storage_rcu_tasks_trace.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_lpm_trie_map.c selftests/bpf: Add LPM trie microbenchmarks 2025-08-27 17:28:14 -07:00
bench_rename.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_ringbufs.c selftests/bpf: Correct two typos 2023-07-07 19:36:04 +02:00
bench_sockmap.c selftests/bpf: Fix incorrect array size calculation 2025-09-09 09:23:47 -07:00
bench_strncmp.c selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
bench_trigger.c selftests/bpf: add benchmark testing for kprobe-multi-all 2025-09-04 09:00:25 -07:00
run_bench_bloom_filter_map.sh bpf/benchs: Add benchmarks for comparing hashmap lookups w/ vs. w/out bloom filter 2021-10-28 13:22:49 -07:00
run_bench_bpf_hashmap_full_update.sh selftest/bpf/benchs: Fix a typo in bpf_hashmap_full_update 2023-02-15 16:29:31 -08:00
run_bench_bpf_loop.sh selftest/bpf/benchs: Add bpf_loop benchmark 2021-11-30 10:56:28 -08:00
run_bench_htab_mem.sh selftests/bpf: Add benchmark for bpf memory allocator 2023-07-05 18:36:19 -07:00
run_bench_local_storage.sh selftests/bpf: Add benchmark for local_storage get 2022-06-22 19:14:33 -07:00
run_bench_local_storage_rcu_tasks_trace.sh selftest/bpf/benchs: Make quiet option common 2023-02-15 16:29:31 -08:00
run_bench_rename.sh selftests/bpf: Clean up fmod_ret in bench_rename test script 2023-08-14 18:43:04 +02:00
run_bench_ringbufs.sh selftests/bpf: Set the default value of consumer_cnt as 0 2023-06-19 13:26:43 -07:00
run_bench_strncmp.sh selftests/bpf: Add benchmark for bpf_strncmp() helper 2021-12-11 17:40:23 -08:00
run_bench_trigger.sh selftests/bpf: add benchmark testing for kprobe-multi-all 2025-09-04 09:00:25 -07:00
run_bench_uprobes.sh selftests/bpf: Add 5-byte NOP uprobe trigger benchmark 2025-04-18 09:03:45 +02:00
run_common.sh selftests/bpf: Add benchmark for local_storage get 2022-06-22 19:14:33 -07:00