From patchwork Wed Jun 5 09:21:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 13686453 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9142F19007C; Wed, 5 Jun 2024 09:21:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579310; cv=none; b=dGyAZxokgcEBLI36bFBQ26kznLh305MsyH+Q5B9RGt9yB17sQG+DAY+TkcmEm2aXDJN1rCBzzc3yEQXTq319LNgysdXPeAP8FikLYPx3V+LazwAxrG+orV1bKjQ23SxKmS9R/o2iXAcq1ROpYCPNCC/9/89H1jpED7OlX2YfySc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579310; c=relaxed/simple; bh=emM8MpMZS/Q1Qm8W6JNJM/DOm/WxwjPphw2aJyCxtSA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q3+icHGraw3CbRGseadoT2n+vVeOUfc5mWLwInGaN1ntaDbhq8s3ag9giyjnQN3kO3LCY7cHutOCr7RenTK5TFsuPNrVqXgk/hQji0nBif0lBlc3AKcX5+mJBCzGh2GvLeAsACUmN5LOLiCfDCTmIXESrlL2bQ2G30dv7NhacfE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ThviTDbk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ThviTDbk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C8CBC32781; Wed, 5 Jun 2024 09:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717579310; bh=emM8MpMZS/Q1Qm8W6JNJM/DOm/WxwjPphw2aJyCxtSA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ThviTDbkdVhbhotmIbBjhdmrfpSZkOqYFb1Wdpc2hfMiR9Uz6s2VQEMAa7GA6OtDd wQyG07UKhritiIOdphqYdk0M5i8NXHPvC1hZecqNGvn50z3g9BpDFvayaZrBopRf1M UEQrVI0E/mLVpZTAFcUzTh8PKNoMSFM19T58DqWx22mBAGPJD0J6bZ6l2U8S/mt/hI LTTwuPAaYre9I9WJZO/9Wk5AwvLb64dl51Hy5lL9Ll/s88+n6xG3XL/bQEYAsx+Xeg XbJYL9W8lCTeuap0l7YIROl562ElIjjAe3tfqTj+/V942jcH5x8GLbdyvRHPtjU+wx XGDlCwZn6MYDw== From: "Matthieu Baerts (NGI0)" Date: Wed, 05 Jun 2024 11:21:16 +0200 Subject: [PATCH net 1/3] selftests: net: lib: support errexit with busywait Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-1-b3afadd368c9@kernel.org> References: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-0-b3afadd368c9@kernel.org> In-Reply-To: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-0-b3afadd368c9@kernel.org> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Petr Machata , Hangbin Liu Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org, Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=955; i=matttbe@kernel.org; h=from:subject:message-id; bh=emM8MpMZS/Q1Qm8W6JNJM/DOm/WxwjPphw2aJyCxtSA=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmYC4n+9+t10gx5+TjFlVOJh5uSwYhfP/lEbay5 akmduvsXxuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZmAuJwAKCRD2t4JPQmmg c3uoEACZR4kugjErlhaqMqZy4acx3u6K4BiclibwUGA85iOBUlw6TX+n2xHYJAbhHlfVDInsc6S JveilSdtfbQWDiM9w6M9HqOq3sh116wYyMuPw7gdnZAZtpc+AnkdN65EBl+AUGY89SBkwNmr+pS mH/Uh3A7JwSFEM7T1aAZUxvKzhtZE4mwecjdMFgxT5Z8VEygWd6KJBWagGIxLLGtpxmE5qSBjlj ErJawSaNd3s0iHQm40tA9mZRcq621peIhQFxRBqtuTL6f1e88tpiWzNnAftdZLATGgRrtvHECJQ GHRfUOFXnFhT/yG0yk9YADynPQMTWp5I/vk06E14QHX1fBC9f5hDEu42Vq+nNPX6EwUOGY+ul8X 81eZNToD5040V5K1RnXd4tlyPhunWIZ51Xa0zrhZk4kscGTOWczOB+38/gqxkvYmR6csHU8dIVH VjwoNoRoZr9mxVqHbZGv/k5YZtYgzXa9v8g1IQEjW0wDfkORsOcToJCdHrWMfULET+0rn1rZgkK JVlS59uPr1IdVksMXqnlZr/fxsC+gha5g2aYSFIXiim3HRsvzMM9FrqaZ5ej8HHesSlMblstF4L jiVJ0FiaxvRYPl6m9MQ3qLnRXKO/0khErnLSsww2h+MiEx2jTHju5kzuk6bN3nZuLGq30NvHe6P R4q9pM4bv9iurJw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 If errexit is enabled ('set -e'), loopy_wait -- or busywait and others using it -- will stop after the first failure. Note that if the returned status of loopy_wait is checked, and even if errexit is enabled, Bash will not stop at the first error. Fixes: 25ae948b4478 ("selftests/net: add lib.sh") Cc: stable@vger.kernel.org Acked-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Hangbin Liu --- tools/testing/selftests/net/lib.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index edc030e81a46..a422e10d3d3a 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -67,9 +67,7 @@ loopy_wait() while true do local out - out=$("$@") - local ret=$? - if ((!ret)); then + if out=$("$@"); then echo -n "$out" return 0 fi From patchwork Wed Jun 5 09:21:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 13686454 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A3D719007C; Wed, 5 Jun 2024 09:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579314; cv=none; b=VghSyVBwiCw6KG7AMwllVeWB7PFH9Kd/YqTyk8nG8KpuUj7IN6xoqSaL6OLwCOLbytjzbQQXiVQazjK3bca7F6hKKba2t1nOY2/FtbRESitgMJVlCg1nGLm3SMIJKjzfdwT1o1S9FdsXx55aSMqf6hkv/GYVXi0pCvTK1mEAkyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579314; c=relaxed/simple; bh=enGOqa2B+5IPGqxwH+TThhdDQRn5ztIFxzAZ0zyx8GY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RkPyjLPkbMjqRDr/hhRr6RILstyRWMIxfsbeAwvRRGAqiB8NGpcHjxy5tYr6yGidHzJjXzz64IlKaMXXZHWE/ikoDnFZGgjG6gJYntAUU98SnqCJcwsIDqdoz74Qbo9fyiQJFOlAh/YfaIHJZ5VBa9N+939Wg2TGCdTx5e9+B/k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uniIUkQ6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uniIUkQ6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A628CC3277B; Wed, 5 Jun 2024 09:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717579313; bh=enGOqa2B+5IPGqxwH+TThhdDQRn5ztIFxzAZ0zyx8GY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uniIUkQ6GLS+bp+dB3bacO+S48J+9YpCBVW0sOBrHTxxPcLQ89xQalHlpg5qRX03K Mmm5hfV+mYWOWxNI+f+oLbPGclIsHRzvsZp1ANVNVlpbFY1nVz4enMCekp3Bs1f0Sy x8n/S8GmkS1x1csFubwno0rc3Rh+zFI2eT1P/NMCQ+oXAExcGQRIIFEPylynEn08f1 pEuIsyWfHHhL7zHKBE0kmYwZlmGn0tgWyBSvY0Dw7tPvxGisoASFv7Epmucvu4xSsn M+OT/oBu/QOL78wN5uWrEtD4OYAbAeBh7zp7IGN04HvIvv9QMtXlTmkcfDTzTneJB0 zwaRsEs8cCLsg== From: "Matthieu Baerts (NGI0)" Date: Wed, 05 Jun 2024 11:21:17 +0200 Subject: [PATCH net 2/3] selftests: net: lib: avoid error removing empty netns name Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-2-b3afadd368c9@kernel.org> References: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-0-b3afadd368c9@kernel.org> In-Reply-To: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-0-b3afadd368c9@kernel.org> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Petr Machata , Hangbin Liu Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org, Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2281; i=matttbe@kernel.org; h=from:subject:message-id; bh=enGOqa2B+5IPGqxwH+TThhdDQRn5ztIFxzAZ0zyx8GY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmYC4nGiVW/UASfgQkNfz8Pi5KnqQIsBRBaxK9z e7j+EROYMyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZmAuJwAKCRD2t4JPQmmg cx+MEACqQPHx7QRfc4oIT4HcCVSlHyo3LxSqv1sAD4887LfJmt9UWzyTVIiJunL3DB1CUGZxyus wDObaEWBokUg2Yny6Gupsxjh0RW7qvjkTEmX+WLToYb7uWwpsll78ilBDS+3m8DbgERFSgCmWti 3Z5QqDmiFaloTgUP7Q71nxN/znbGiU5B6b/yue2IDdMWJWjpMBEKbXl4vtpbTCFf0brz6wJEjQ9 lwEEx+q6z6XjMFr7oHGdH7cL+l7fUTN2nGfCsYjCX1ri9GIulZ8D4ial+OSyZcyyOAumhd14oyZ znG9ycG9rpx+tNRr/aq72m0UPTLdjprWLUxdqsD81z+aOEO0Ygtf8OS9vzyTL/DEcQqFIegyzZn WweEgz6O+kiTlHUOxjrcc9OiTXQaoCdKOLbdZgWZjyIHdpHh9NgggbJJk8Eh7E04Iy4wfSUlO2M d9sszu3f+fqLwsPN93f0nknFFzftjqCEetQ/q3QnJPGBPhidjrbbfvA3nPUAoXBrEinxCwNyb+O fR5UUn3IOhR8GgpJRdTIQA7BJ66ShLIW74kzI/ZyLsV1WxKZhFMkv16xnIDwbOX8RT4nBoiHCWW C6cU0wlwiiWgmQWTBklNvELv3N3skyQ2vSpAkPFSdUBsDgisFxNji/OIgYh+CzZyEcW5Flb/y/n Nz2pQjsY+x3QVVg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 If there is an error to create the first netns with 'setup_ns()', 'cleanup_ns()' will be called with an empty string as first parameter. The consequences is that 'cleanup_ns()' will try to delete an invalid netns, and wait 20 seconds if the netns list is empty. Instead of just checking if the name is not empty, convert the string separated by spaces to an array. Manipulating the array is cleaner, and calling 'cleanup_ns()' with an empty array will be a no-op. Fixes: 25ae948b4478 ("selftests/net: add lib.sh") Cc: stable@vger.kernel.org Acked-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Petr Machata Reviewed-by: Hangbin Liu --- tools/testing/selftests/net/lib.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index a422e10d3d3a..e2f51102d7e1 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -15,7 +15,7 @@ ksft_xfail=2 ksft_skip=4 # namespace list created by setup_ns -NS_LIST="" +NS_LIST=() ############################################################################## # Helpers @@ -137,6 +137,7 @@ cleanup_ns() fi for ns in "$@"; do + [ -z "${ns}" ] && continue ip netns delete "${ns}" &> /dev/null if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then echo "Warn: Failed to remove namespace $ns" @@ -150,7 +151,7 @@ cleanup_ns() cleanup_all_ns() { - cleanup_ns $NS_LIST + cleanup_ns "${NS_LIST[@]}" } # setup netns with given names as prefix. e.g @@ -159,7 +160,7 @@ setup_ns() { local ns="" local ns_name="" - local ns_list="" + local ns_list=() local ns_exist= for ns_name in "$@"; do # Some test may setup/remove same netns multi times @@ -175,13 +176,13 @@ setup_ns() if ! ip netns add "$ns"; then echo "Failed to create namespace $ns_name" - cleanup_ns "$ns_list" + cleanup_ns "${ns_list[@]}" return $ksft_skip fi ip -n "$ns" link set lo up - ! $ns_exist && ns_list="$ns_list $ns" + ! $ns_exist && ns_list+=("$ns") done - NS_LIST="$NS_LIST $ns_list" + NS_LIST+=("${ns_list[@]}") } tc_rule_stats_get() From patchwork Wed Jun 5 09:21:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 13686455 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A93111922D2; Wed, 5 Jun 2024 09:21:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579317; cv=none; b=tz9vY0W8wLb01v/hBEaKKOGVuqB1VDRsJGuTzRaRD4tz2jpqBjwTba9MCK6G61v2mp8a792N/WIttJof0OB+eZoOXaA5Oc8CCrE5x/Gtvlfek8UBVas+q5O1JLrIW9JaYcMgNg2/wgF6UkyQFF2wsL+FjKDAll2iMj92SNnpa4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579317; c=relaxed/simple; bh=8P3FRjsCJEzDXjJHU+ebT7e/zra1DAmqDTABQdJrGvg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=atirvqcldcwHAsU4O30GPDYQjf9e7Ypc2ysEmqBqNNwm/OO0jUlOiFq2T1d8NtWmDddySKN1KhwwFGGNhDJ6SrX4GN0VOIPc81lzzqHH4KjKvJx6pioEpkoaCEYAOF2n+cJVhViGSBp87Km48RdXvRzRjvibMbexE1HGUwiqAhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tATS6KKm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tATS6KKm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22CBFC32781; Wed, 5 Jun 2024 09:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717579317; bh=8P3FRjsCJEzDXjJHU+ebT7e/zra1DAmqDTABQdJrGvg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tATS6KKmR+QkxjIT2Wsql1HRYBVZocSUE/m++vf3bWsXWw+VgFSQ99GDgzG3y41pJ FtmMaENxUp3Yr5mjOcRM2C3e2dlU93M0fNMzfD/I08cNWyVQVsMK7XSmdW09FGby8S u+0uIq+5gqgcvZhWkkC6zrn/hRHwM39OerV9bFRBsIqdSXvnRLpC2YB+7mLh8XfLT4 FOxIhgAUgwrVnSS+MwsLM2yafmH3/yPHdMWFugTr3OHuXFKmRjpgKaMXsPswX17fTX gL0lSPLpYr5e0N/wdAMdENVE6qMWd1Axzm+hclOWc4jWhBn0dJUbBF4GtwTB9F3R99 joqeaV0razKig== From: "Matthieu Baerts (NGI0)" Date: Wed, 05 Jun 2024 11:21:18 +0200 Subject: [PATCH net 3/3] selftests: net: lib: set 'i' as local Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-3-b3afadd368c9@kernel.org> References: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-0-b3afadd368c9@kernel.org> In-Reply-To: <20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-0-b3afadd368c9@kernel.org> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Petr Machata , Hangbin Liu Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1157; i=matttbe@kernel.org; h=from:subject:message-id; bh=8P3FRjsCJEzDXjJHU+ebT7e/zra1DAmqDTABQdJrGvg=; b=kA0DAAgB9reCT0JpoHMByyZiAGZgLiehkfETklVcL6kiyeMZ25HVrqQyKurMNJfqTMuViABsq IkCMwQAAQgAHRYhBOjLhfdodwV6bif3eva3gk9CaaBzBQJmYC4nAAoJEPa3gk9CaaBztswP/AsM NFpBCj+QO3MUO5BAadFkNCsQXfDciG9ZoOUlQf0mnjcbK90K82iStHfA9uqQPInYWcECTl68/kD 7Y91s96zW2ibzCS+FPgpJbuHyZCIYKEUT4I5kdsBgI1MiidWIROdY0Rc/scGgydeMhUWP2+Xmfy 9ohF/+filwHnTCRyEeY95SCrJAi2BmGyz5q+oGpebZBfpaLLUjiWfThJbBGlQ+ZEalESJs2jhIQ QYa+fzDW+h/A87Q9nTjCxtCV/Jm+buo6Q/nNHfGdOJLiPwdNOprRGgxxJNzfb/jq5KG6xNNy3eB JIgrw81Xva5cqigPxgqDXicqd0NaDLKnjJf77zNmPUaPAy0slrpULXQyj7gW9bCSXdJQY+D4vyV XCYJdvtNZvV2abzJ6pw/xYGJj5xePTmqiOaI/AycmWw1jGe4smPe9lfkdXxNRnUyNF6GEdOdWM1 229SXuw1TL86hEbV3ZtKfVV5w0+jc3vOkN+K7uABdHSqp8Kjs6UmJJmDk9btKNBiaBmIVw97QJY GFdHTHu2CZjmDGL2Um9NfxRvhHczrLdnn7UPDLJYfTOGzySPNibGYnV6/Pu6VPHgSZ6PZJGiQx1 kXsDvE+SWvUjxy2b4KhLF9mO+VHUZN7i/UHXYmtzqQWomyx9YdZQ8Uq8HQ97pfoiqsdYAvOWsLn /miyX X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 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 Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Hangbin Liu --- 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