lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b947dd2-5891-457c-8511-52781764857d@redhat.com>
Date: Tue, 15 Oct 2024 10:22:49 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Petr Machata <petrm@...dia.com>, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 netdev@...r.kernel.org
Cc: linux-kselftest@...r.kernel.org, Shuah Khan <shuah@...nel.org>,
 Benjamin Poirier <bpoirier@...dia.com>, Hangbin Liu <liuhangbin@...il.com>,
 Vladimir Oltean <vladimir.oltean@....com>, Ido Schimmel <idosch@...dia.com>,
 Przemek Kitszel <przemyslaw.kitszel@...el.com>, mlxsw@...dia.com
Subject: Re: [PATCH net-next 01/10] selftests: net: lib: Introduce deferred
 commands

Hi,

On 10/9/24 14:06, Petr Machata wrote:
> diff --git a/tools/testing/selftests/net/lib/sh/defer.sh b/tools/testing/selftests/net/lib/sh/defer.sh
> new file mode 100644
> index 000000000000..8d205c3f0445
> --- /dev/null
> +++ b/tools/testing/selftests/net/lib/sh/defer.sh
> @@ -0,0 +1,115 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +# map[(scope_id,track,cleanup_id) -> cleanup_command]
> +# track={d=default | p=priority}
> +declare -A __DEFER__JOBS
> +
> +# map[(scope_id,track) -> # cleanup_commands]
> +declare -A __DEFER__NJOBS
> +
> +# scope_id of the topmost scope.
> +__DEFER__SCOPE_ID=0
> +
> +__defer__ndefer_key()
> +{
> +	local track=$1; shift

Minor nit: IMHO the trailing shift is here a bit confusing: it let me 
think about other arguments, which are not really expected.

[...]
> +__defer__schedule()
> +{
> +	local track=$1; shift
> +	local ndefers=$(__defer__ndefers $track)
> +	local ndefers_key=$(__defer__ndefer_key $track)
> +	local defer_key=$(__defer__defer_key $track $ndefers)
> +	local defer="$@"
> +
> +	__DEFER__JOBS[$defer_key]="$defer"
> +	__DEFER__NJOBS[$ndefers_key]=$((${__DEFER__NJOBS[$ndefers_key]} + 1))

'${__DEFER__NJOBS[$ndefers_key]}' is actually '$ndefers', right? If so 
it would be better to reuse the avail variable.

Thanks,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ