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] [day] [month] [year] [list]
Message-ID: <20241103135429.1556ea05@kernel.org>
Date: Sun, 3 Nov 2024 13:54:29 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Rosen Penev <rosenp@...il.com>
Cc: netdev@...r.kernel.org, Jian Shen <shenjian15@...wei.com>, Salil Mehta
 <salil.mehta@...wei.com>, Andrew Lunn <andrew+netdev@...n.ch>, "David S.
 Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo
 Abeni <pabeni@...hat.com>, Jijie Shao <shaojijie@...wei.com>, Wei Fang
 <wei.fang@....com>, Louis Peens <louis.peens@...igine.com>,
 "justinstitt@...gle.com" <justinstitt@...gle.com>, Jacob Keller
 <jacob.e.keller@...el.com>, Wojciech Drewek <wojciech.drewek@...el.com>,
 Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>, Javier Carrasco
 <javier.carrasco.cruz@...il.com>, Hongbo Li <lihongbo22@...wei.com>,
 Yonglong Liu <liuyonglong@...wei.com>, Uwe Kleine-König
 <u.kleine-koenig@...libre.com>, Ahmed Zaki <ahmed.zaki@...el.com>, Arnd
 Bergmann <arnd@...db.de>, Kalesh AP <kalesh-anakkur.purayil@...adcom.com>,
 Simon Horman <horms@...nel.org>, Jie Wang <wangjie125@...wei.com>, Peiyang
 Wang <wangpeiyang1@...wei.com>, Hao Lan <lanhao@...wei.com>,
 linux-kernel@...r.kernel.org (open list)
Subject: Re: [PATCH net-next] net: hisilicon: use ethtool string helpers

On Wed, 30 Oct 2024 15:07:46 -0700 Rosen Penev wrote:
> -static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats,
> -		u32 stat_count, u32 num_tqps, const char *prefix)
> +static void hns3_update_strings(u8 **data, const struct hns3_stats *stats,
> +				u32 stat_count, u32 num_tqps,
> +				const char *prefix)
>  {
>  #define MAX_PREFIX_SIZE (6 + 4)

This define can also go away

> -	u32 size_left;
>  	u32 i, j;
> -	u32 n1;
>  
> -	for (i = 0; i < num_tqps; i++) {
> -		for (j = 0; j < stat_count; j++) {
> -			data[ETH_GSTRING_LEN - 1] = '\0';
> -
> -			/* first, prepend the prefix string */
> -			n1 = scnprintf(data, MAX_PREFIX_SIZE, "%s%u_",
> -				       prefix, i);
> -			size_left = (ETH_GSTRING_LEN - 1) - n1;
> -
> -			/* now, concatenate the stats string to it */
> -			strncat(data, stats[j].stats_string, size_left);
> -			data += ETH_GSTRING_LEN;
> -		}
> -	}
> -
> -	return data;
> +	for (i = 0; i < num_tqps; i++)
> +		for (j = 0; j < stat_count; j++)
> +			ethtool_sprintf(data, "%s%u_%s", prefix, i,
> +					stats[j].stats_string);
>  }
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ