From: David Laight <david.laight.linux@gmail.com>
To: Tung Quang Nguyen <tung.quang.nguyen@est.tech>
Cc: Ajith P V <ajithpv.linux@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"tipc-discussion@lists.sourceforge.net"
<tipc-discussion@lists.sourceforge.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jmaloy@redhat.com" <jmaloy@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"horms@kernel.org" <horms@kernel.org>
Subject: Re: [PATCH net-next v3] tipc: replace deprecated strcpy with strscpy in tipc_bearer_get_name()
Date: Mon, 17 Aug 2026 15:23:50 +0100 [thread overview]
Message-ID: <20260817152350.573c4eff@pumpkin> (raw)
In-Reply-To: <GV1P189MB1988B4FA71085BFFB31AF4CDC6A72@GV1P189MB1988.EURP189.PROD.OUTLOOK.COM>
On Mon, 17 Aug 2026 07:53:53 +0000
Tung Quang Nguyen <tung.quang.nguyen@est.tech> wrote:
> >Subject: Re: [PATCH net-next v3] tipc: replace deprecated strcpy with strscpy in
> >tipc_bearer_get_name()
> >
> >> net tree:
> >> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
> >> net-next tree:
> >> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
> >
> >Thank you. I tried the correct net-next tree. The same patch applied
> >successfully here also as shown below.
> >
> ><path of the linux tree>/net-next$ ls
> >arch certs CREDITS Documentation fs init ipc Kconfig lib
> >MAINTAINERS mm README samples security tools virt
> >block COPYING crypto drivers include io_uring Kbuild kernel LICENSES
> >Makefile net rust scripts sound usr
> ><path of the linux tree>/net-next$ git remote -v
> >origin https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
> >(fetch)
> >origin https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
> >(push)
> ><path of the linux tree>/net-next$ git am ../../patches/v3-0001-tipc-replace-
> >deprecated-strcpy-with-strscpy-in-ti.patch
> >Applying: tipc: replace deprecated strcpy with strscpy in
> >tipc_bearer_get_name() <path of the linux tree>/net-next$ git branch
> >* main
> ><path of the linux tree>/net-next$
> >
> >Am I missing something?
>
> I see that your patch was applied again successfully after failure.
> There is one feedback from AI review that I see valid:
> [...]
> > @@ -209,7 +209,7 @@ int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id)
> > if (!b)
> > return -EINVAL;
> >
> > - strcpy(name, b->name);
> > + strscpy(name, b->name, TIPC_MAX_BEARER_NAME);
> This isn't a bug, but the destination capacity is now hard-coded in the
> body while the interface says nothing about it. The declaration in
> net/tipc/bearer.h is still:
> int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id);
> and the comment directly above the implementation only says:
> * @name: a pointer to the buffer where the name will be stored.
> Should the TIPC_MAX_BEARER_NAME requirement be spelled out in the comment
> or in the prototype, so that the interface and the body agree?
> In the current tree there is no behavioural change: the only caller is
> __tipc_nl_add_monitor() in net/tipc/monitor.c, which declares
> char bearer_name[TIPC_MAX_BEARER_NAME], and the source is
> char name[TIPC_MAX_BEARER_NAME] in struct tipc_bearer, so the copy can
> neither truncate nor overflow.
> The strscpy() return value is also discarded, so a future caller passing a
> smaller buffer would get a silently truncated name plus a return of 0.
> Would passing a size_t len from the caller (sizeof(bearer_name)) and
> forwarding strscpy()'s -E2BIG through the existing int return be preferable
> to a hard-coded bound?
> [...]
>
> Please update your patch and send the new version after Aug 31st. (Because net-next is closed now)
>
One 'solution' to the non-problem is to embed the array in a struct.
Although (IIRC) this is a uapi constant so that may not be completely
possible.
Otherwise I'd ignore the AI review.
David
prev parent reply other threads:[~2026-08-17 14:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 10:22 [PATCH net-next v3] tipc: replace deprecated strcpy with strscpy in tipc_bearer_get_name() Ajith P V
2026-08-14 9:00 ` Tung Quang Nguyen
2026-08-14 12:55 ` Ajith P V
2026-08-14 13:03 ` Tung Quang Nguyen
2026-08-14 16:08 ` Ajith P V
2026-08-17 7:53 ` Tung Quang Nguyen
2026-08-17 14:23 ` David Laight [this message]
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=20260817152350.573c4eff@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=ajithpv.linux@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.