Skip to content

Commit 3e707b0

Browse files
l0kodkees
authored andcommitted
selftests: ktap_helpers: Fix uninitialized variable
__ktap_test() may be called without the optional third argument which is an issue for scripts using `set -u` to detect uninitialized variables and potential bugs. Fix this optional "directive" argument by either using the third argument or an empty string. This is required for the next commit to properly test script execution control. Cc: Kees Cook <kees@kernel.org> Cc: Nícolas F. R. A. Prado <nfraprado@collabora.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Fixes: 14571ab ("kselftest: Add new test for detecting unprobed Devicetree devices") Signed-off-by: Mickaël Salaün <mic@digikod.net> Link: https://lore.kernel.org/r/20241212174223.389435-7-mic@digikod.net Signed-off-by: Kees Cook <kees@kernel.org>
1 parent faf2d88 commit 3e707b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/kselftest/ktap_helpers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ktap_skip_all() {
4040
__ktap_test() {
4141
result="$1"
4242
description="$2"
43-
directive="$3" # optional
43+
directive="${3:-}" # optional
4444

4545
local directive_str=
4646
[ ! -z "$directive" ] && directive_str="# $directive"

0 commit comments

Comments
 (0)