selftests: net: lib: set 'i' as local
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Wed, 5 Jun 2024 09:21:18 +0000 (11:21 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 6 Jun 2024 15:29:07 +0000 (08:29 -0700)
commit84a8bc3ec225b28067b168e9410e452c83d706da
treee759994fef9a02076b1e854955db06869bf1fdb6
parent79322174bcc780b99795cb89d237b26006a8b94b
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: 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>
tools/testing/selftests/net/lib.sh