Re: [PATCH bpf-next 7/7] selftests/bpf: Add XDP load-balancer benchmark run script

sashiko-bot
2026-04-28T02:03:39Z

Sashiko AI review found 1 potential issue(s):
- [Medium] Any extra arguments passed to the script are silently ignored because `"$@"` is used incorrectly inside the `run_scenario` bash function.
--

commit eb02fb82c543ffe6f8607af5eadc8ba489f2fb53
Author: Puranjay Mohan <puranjay@kernel.org>

selftests/bpf: Add XDP load-balancer benchmark run script

This commit adds a convenience script to run 24 XDP load-balancer scenarios.
It formats the benchmark results as a table displaying the median, standard
deviation, and 99th percentile.

> diff --git a/tools/testing/selftests/bpf/benchs/run_bench_xdp_lb.sh b/tools/testing/selftests/bpf/benchs/run_bench_xdp_lb.sh
> new file mode 100755
> index 000000000000..f65cf46214a3
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/benchs/run_bench_xdp_lb.sh

[ ... ]

> +function run_scenario()
> +{
> + local sc="$1"
> + shift
> + local output rline
> +
> + output=$($RUN --scenario "$sc" "$@" 2>&1) || true

Does this silently ignore extra arguments passed to the script?

In bash, "$@" inside a function evaluates to the arguments passed to that
specific function, not the global script arguments. Since run_scenario is
called with exactly one argument ($sc) throughout the script, shift will
consume it and leave "$@" empty.

Should the script's global arguments be passed explicitly to run_scenario
when it is called, or should the script store its arguments in a global array?

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260427232313.1582588-1-puranjay@kernel.org?part=7