selftests/bpf: Reject unsupported -k option in vmtest.sh
Subsystems (3)
PATCH 1/1 selftests/bpf: Reject unsupported -k option in vmtest.sh
vmtest.sh does not document a -k option and does not handle it in the getopts case statement. However, the getopts optstring includes k, which causes the script to accept -k silently instead of reporting it as an invalid option.
Remove k from the optstring so unsupported options are rejected through the existing invalid-option path.
--- tools/testing/selftests/bpf/vmtest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/vmtest.sh +1 -1
@@ -382,7 +382,7 @@ main() local exit_command="poweroff -f" local debug_shell="no" - while getopts ':hskl:id:j:' opt; do + while getopts ':hsl:id:j:' opt; do case ${opt} in l) LOCAL_ROOTFS_IMAGE="$OPTARG"
base-commit: a828abbb897657451d96ad7bf20f1893ac983bb9
Signature · 1 line
2.54.0
Quoted 10 lines · Roman Kvasnytskyi
vmtest.shdoes not document a -k option and does not handle it in the getopts case statement. However, the getopts optstring includes k, which causes the script to accept -k silently instead of reporting it as an invalid option.Remove k from the optstring so unsupported options are rejected through the existing invalid-option path.
Fixes c9709f52386d ("bpf: Helper script for running BPF presubmit tests")Signed-off-by Roman Kvasnytskyi <[email protected]>
I'm unsure this needs to go through the bpf tree, but it currently applies cleanly to both bpf-next and bpf anyway.
Quoted 23 lines
--- tools/testing/selftests/bpf/vmtest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/bpf/vmtest.sh +1
-1@@ -382,7 +382,7 @@ main() local exit_command="poweroff -f" local debug_shell="no" - while getopts ':hskl:id:j:' opt; do + while getopts ':hsl:id:j:' opt; do case ${opt} in l) LOCAL_ROOTFS_IMAGE="$OPTARG"base-commit:
a828abbb897657451d96ad7bf20f1893ac983bb9Signature · 1 line
2.54.0
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 9 lines · On Sat, 16 May 2026 14:06:25 +0200 you wrote:
vmtest.shdoes not document a -k option and does not handle it in the getopts case statement. However, the getopts optstring includes k, which causes the script to accept -k silently instead of reporting it as an invalid option.Remove k from the optstring so unsupported options are rejected through the existing invalid-option path.
[...]
Here is the summary with links:
- [bpf] selftests/bpf: Reject unsupported -k option in vmtest.sh
https://git.kernel.org/bpf/bpf-next/c/6df582112aa9
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html