From: Simon Horman <horms@kernel.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Jon Maloy <jmaloy@redhat.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Tung Quang Nguyen <tung.quang.nguyen@est.tech>,
tipc-discussion@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [PATCH v2 net-next] tipc: adjust tipc_nodeid2string() to return string length
Date: Thu, 25 Sep 2025 13:47:07 +0100 [thread overview]
Message-ID: <20250925124707.GH836419@horms.kernel.org> (raw)
In-Reply-To: <20250924112649.1371695-1-dmantipov@yandex.ru>
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
>
>
next prev parent reply other threads:[~2025-09-25 12:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 11:26 [PATCH v2 net-next] tipc: adjust tipc_nodeid2string() to return string length Dmitry Antipov
2025-09-25 1:41 ` Tung Quang Nguyen
2025-09-25 12:47 ` Simon Horman [this message]
2025-09-25 16:51 ` [PATCH v3 net-next] tipc: adjust tipc_nodeid2string() to check the length of the result Dmitry Antipov
2025-09-26 3:34 ` Tung Quang Nguyen
2025-09-26 7:41 ` [PATCH v4 net-next] tipc: adjust tipc_nodeid2string() to return string length Dmitry Antipov
2025-09-26 10:29 ` Tung Quang Nguyen
2025-09-26 15:41 ` Simon Horman
2025-09-30 9:40 ` patchwork-bot+netdevbpf
2025-09-26 15:39 ` [PATCH v3 net-next] tipc: adjust tipc_nodeid2string() to check the length of the result Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250925124707.GH836419@horms.kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=dmantipov@yandex.ru \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=tung.quang.nguyen@est.tech \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).