diff options
author | Matthieu Baerts (NGI0) <matttbe@kernel.org> | 2024-06-05 12:21:18 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-06-12 12:39:45 +0300 |
commit | 79c722e06b1884439ab6efd6502bd9a2f414df3f (patch) | |
tree | d9defe8b44282f329593f17cbc5d388748d49b8e | |
parent | 0a1cb0c6102bb4fd310243588d39461da49497ad (diff) | |
download | linux-79c722e06b1884439ab6efd6502bd9a2f414df3f.tar.xz |
selftests: net: lib: set 'i' as local
commit 84a8bc3ec225b28067b168e9410e452c83d706da upstream.
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: 596c8819cb78 ("selftests: forwarding: Have RET track kselftest framework constants")
Acked-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-3-b3afadd368c9@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | tools/testing/selftests/net/lib.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index fb640fb9e8d3..cf7fe4d550dd 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -22,6 +22,7 @@ __ksft_status_merge() local -A weights local weight=0 + local i for i in "$@"; do weights[$i]=$((weight++)) done |