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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250925124707.GH836419@horms.kernel.org>
Date: Thu, 25 Sep 2025 13:47:07 +0100
From: Simon Horman <horms@...nel.org>
To: Dmitry Antipov <dmantipov@...dex.ru>
Cc: Jon Maloy <jmaloy@...hat.com>, "David S . Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>,
	Tung Quang Nguyen <tung.quang.nguyen@....tech>,
	tipc-discussion@...ts.sourceforge.net, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next] tipc: adjust tipc_nodeid2string() to return
 string length

On Wed, Sep 24, 2025 at 02:26:49PM +0300, Dmitry Antipov wrote:

...

> diff --git a/net/tipc/link.c b/net/tipc/link.c
> index 3ee44d731700..e61872b5b2b3 100644
> --- a/net/tipc/link.c
> +++ b/net/tipc/link.c
> @@ -495,11 +495,9 @@ bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
>  
>  	/* Set link name for unicast links only */
>  	if (peer_id) {
> -		tipc_nodeid2string(self_str, tipc_own_id(net));
> -		if (strlen(self_str) > 16)
> +		if (tipc_nodeid2string(self_str, tipc_own_id(net)) > 16)
>  			sprintf(self_str, "%x", self);

I see this is a nice clean-up. Thanks.

Would it make sense to move the '> 16' logic also be folded into
tipc_nodeid2string(), or a wrapper provided, to further simplify the
callers?

> -		tipc_nodeid2string(peer_str, peer_id);
> -		if (strlen(peer_str) > 16)
> +		if (tipc_nodeid2string(peer_str, peer_id) > 16)
>  			sprintf(peer_str, "%x", peer);
>  	}
>  	/* Peer i/f name will be completed by reset/activate message */
> @@ -570,8 +568,7 @@ bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer, u8 *peer_id,
>  	if (peer_id) {
>  		char peer_str[NODE_ID_STR_LEN] = {0,};
>  
> -		tipc_nodeid2string(peer_str, peer_id);
> -		if (strlen(peer_str) > 16)
> +		if (tipc_nodeid2string(peer_str, peer_id) > 16)
>  			sprintf(peer_str, "%x", peer);
>  		/* Broadcast receiver link name: "broadcast-link:<peer>" */
>  		snprintf(l->name, sizeof(l->name), "%s:%s", tipc_bclink_name,
> -- 
> 2.51.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ