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: <92e3c2c4-4384-04ae-2016-ad9be8a3fc9b@akamai.com>
Date:   Wed, 7 Sep 2022 10:10:05 -0400
From:   Jason Baron <jbaron@...mai.com>
To:     Jim Cromie <jim.cromie@...il.com>, gregkh@...uxfoundation.org,
        dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
        intel-gvt-dev@...ts.freedesktop.org,
        intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc:     daniel.vetter@...ll.ch, seanpaul@...omium.org, robdclark@...il.com,
        linux@...musvillemoes.dk, joe@...ches.com
Subject: Re: [PATCH v6 10/57] dyndbg: cleanup auto vars in dynamic_debug_init



On 9/4/22 17:40, Jim Cromie wrote:
> rework var-names for clarity, regularity
> rename variables
>   - n to mod_sites - it counts sites-per-module
>   - entries to i - display only
>   - iter_start to iter_mod_start - marks start of each module's subrange
>   - modct to mod_ct - stylistic
> 
> new iterator var:
>   - site - cursor parallel to iter
>     1st step towards 'demotion' of iter->site, for removal later
> 
> treat vars as iters:
>   - drop init at top
>     init just above for-loop, in a textual block
> 
> Signed-off-by: Jim Cromie <jim.cromie@...il.com>
> ---
>  lib/dynamic_debug.c | 33 +++++++++++++++++----------------
>  1 file changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index e96dc216463b..2e8ebef3bd0d 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -1059,11 +1059,10 @@ static int __init dynamic_debug_init_control(void)
>  
>  static int __init dynamic_debug_init(void)
>  {
> -	struct _ddebug *iter, *iter_start;
> -	const char *modname = NULL;
> +	struct _ddebug *iter, *iter_mod_start;
> +	int ret, i, mod_sites, mod_ct;
> +	const char *modname;
>  	char *cmdline;
> -	int ret = 0;
> -	int n = 0, entries = 0, modct = 0;
>  
>  	if (&__start___dyndbg == &__stop___dyndbg) {
>  		if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) {
> @@ -1074,30 +1073,32 @@ static int __init dynamic_debug_init(void)
>  		ddebug_init_success = 1;
>  		return 0;
>  	}
> -	iter = __start___dyndbg;
> +
> +	iter = iter_mod_start = __start___dyndbg;
>  	modname = iter->modname;
> -	iter_start = iter;
> -	for (; iter < __stop___dyndbg; iter++) {
> -		entries++;
> +	i = mod_sites = mod_ct = 0;
> +
> +	for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) {
> +

Just a small nit here - not sure why there's an extra blank line here?
But either way:

Acked-by: Jason Baron <jbaron@...mai.com>


>  		if (strcmp(modname, iter->modname)) {
> -			modct++;
> -			ret = ddebug_add_module(iter_start, n, modname);
> +			mod_ct++;
> +			ret = ddebug_add_module(iter_mod_start, mod_sites, modname);
>  			if (ret)
>  				goto out_err;
> -			n = 0;
> +
> +			mod_sites = 0;
>  			modname = iter->modname;
> -			iter_start = iter;
> +			iter_mod_start = iter;
>  		}
> -		n++;
>  	}
> -	ret = ddebug_add_module(iter_start, n, modname);
> +	ret = ddebug_add_module(iter_mod_start, mod_sites, modname);
>  	if (ret)
>  		goto out_err;
>  
>  	ddebug_init_success = 1;
>  	vpr_info("%d prdebugs in %d modules, %d KiB in ddebug tables, %d kiB in __dyndbg section\n",
> -		 entries, modct, (int)((modct * sizeof(struct ddebug_table)) >> 10),
> -		 (int)((entries * sizeof(struct _ddebug)) >> 10));
> +		 i, mod_ct, (int)((mod_ct * sizeof(struct ddebug_table)) >> 10),
> +		 (int)((i * sizeof(struct _ddebug)) >> 10));
>  
>  	/* now that ddebug tables are loaded, process all boot args
>  	 * again to find and activate queries given in dyndbg params.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ