From: Hangbin Liu <liuhangbin@gmail.com>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Cc: mptcp@lists.linux.dev, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Shuah Khan <shuah@kernel.org>, Petr Machata <petrm@nvidia.com>,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Geliang Tang <geliang@kernel.org>
Subject: Re: [PATCH net 3/3] selftests: net: lib: set 'i' as local
Date: Thu, 6 Jun 2024 10:13:34 +0800 [thread overview]
Message-ID: <ZmEbTvuUOGxc-quG@Laptop-X1> (raw)
In-Reply-To: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-3-b3afadd368c9@kernel.org>
On Wed, Jun 05, 2024 at 11:21:18AM +0200, Matthieu Baerts (NGI0) wrote:
> 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>
> ---
> tools/testing/selftests/net/lib.sh | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
> index e2f51102d7e1..9155c914c064 100644
> --- a/tools/testing/selftests/net/lib.sh
> +++ b/tools/testing/selftests/net/lib.sh
> @@ -27,6 +27,7 @@ __ksft_status_merge()
> local -A weights
> local weight=0
>
> + local i
> for i in "$@"; do
> weights[$i]=$((weight++))
> done
>
> --
> 2.43.0
>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
next prev parent reply other threads:[~2024-06-06 2:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 9:21 [PATCH net 0/3] selftests: net: lib: small fixes Matthieu Baerts (NGI0)
2024-06-05 9:21 ` [PATCH net 1/3] selftests: net: lib: support errexit with busywait Matthieu Baerts (NGI0)
2024-06-05 9:44 ` Hangbin Liu
2024-06-05 9:58 ` Matthieu Baerts
2024-06-05 9:21 ` [PATCH net 2/3] selftests: net: lib: avoid error removing empty netns name Matthieu Baerts (NGI0)
2024-06-05 10:38 ` Petr Machata
2024-06-05 14:12 ` Matthieu Baerts
2024-06-05 14:30 ` Petr Machata
2024-06-05 14:33 ` Matthieu Baerts
2024-06-06 2:15 ` Hangbin Liu
2024-06-05 9:21 ` [PATCH net 3/3] selftests: net: lib: set 'i' as local Matthieu Baerts (NGI0)
2024-06-06 2:13 ` Hangbin Liu [this message]
2024-06-06 15:40 ` [PATCH net 0/3] selftests: net: lib: small fixes patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZmEbTvuUOGxc-quG@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.