Skip to content

Commit 84a8bc3

Browse files
matttbekuba-moo
authored andcommitted
selftests: net: lib: set 'i' as local
Without this, the 'i' variable declared before could be overridden by accident, e.g. for i in "${@}"; do __ksft_status_merge "${i}" ## 'i' has been modified foo "${i}" ## using 'i' with an unexpected value done After a quick look, it looks like 'i' is currently not used after having been modified in __ksft_status_merge(), but still, better be safe than sorry. I saw this while modifying the same file, not because I suspected an issue somewhere. Fixes: 596c881 ("selftests: forwarding: Have RET track kselftest framework constants") Acked-by: Geliang Tang <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Reviewed-by: Hangbin Liu <[email protected]> Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-3-b3afadd368c9@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7932217 commit 84a8bc3

File tree

1 file changed

+1
-0
lines changed
  • tools/testing/selftests/net

1 file changed

+1
-0
lines changed

tools/testing/selftests/net/lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ __ksft_status_merge()
2727
local -A weights
2828
local weight=0
2929

30+
local i
3031
for i in "$@"; do
3132
weights[$i]=$((weight++))
3233
done

0 commit comments

Comments
 (0)