* [PATCH] net: ipconfig: replace strncpy with strscpy
@ 2025-06-07 15:28 Pranav Tyagi
2025-06-07 16:42 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Pranav Tyagi @ 2025-06-07 15:28 UTC (permalink / raw)
To: davem, dsahern, edumazet, kuba, pabeni, horms
Cc: skhan, netdev, linux-kernel, linux-kernel-mentees, Pranav Tyagi
Replace the deprecated strncpy() with strscpy() as the destination
buffer is NUL-terminated and does not require any
trailing NUL-padding. Also increase the length to 252
as NUL-termination is guaranteed.
Signed-off-by: Pranav Tyagi <pranav.tyagi03@gmail.com>
---
net/ipv4/ipconfig.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index c56b6fe6f0d7..eb9b32214e60 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1690,7 +1690,7 @@ static int __init ic_proto_name(char *name)
*v = 0;
if (kstrtou8(client_id, 0, dhcp_client_identifier))
pr_debug("DHCP: Invalid client identifier type\n");
- strncpy(dhcp_client_identifier + 1, v + 1, 251);
+ strscpy(dhcp_client_identifier + 1, v + 1, 252);
*v = ',';
}
return 1;
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ipconfig: replace strncpy with strscpy
2025-06-07 15:28 [PATCH] net: ipconfig: replace strncpy with strscpy Pranav Tyagi
@ 2025-06-07 16:42 ` Simon Horman
2025-06-11 14:12 ` Pranav Tyagi
0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2025-06-07 16:42 UTC (permalink / raw)
To: Pranav Tyagi
Cc: davem, dsahern, edumazet, kuba, pabeni, skhan, netdev,
linux-kernel, linux-kernel-mentees
On Sat, Jun 07, 2025 at 08:58:30PM +0530, Pranav Tyagi wrote:
> Replace the deprecated strncpy() with strscpy() as the destination
> buffer is NUL-terminated and does not require any
> trailing NUL-padding. Also increase the length to 252
> as NUL-termination is guaranteed.
>
> Signed-off-by: Pranav Tyagi <pranav.tyagi03@gmail.com>
Hi Pranav,
As a non-bug fix for Networking code this should be targeted
at net-next. And it's helpful to do so explicitly in the patch subject,
like this:
[PATCH v2 net-next] ...
Also, unfortunately the timing of this patch is not good
as net-next is currently closed for the merge window.
You can find more information about the above,
and other aspects of the workflow for the Networking subsystem
in https://docs.kernel.org/process/maintainer-netdev.html
## Form letter - net-next-closed
The merge window for v6.16 has begun and therefore net-next is closed
for new drivers, features, code refactoring and optimizations. We are
currently accepting bug fixes only.
Please repost when net-next reopens after June 8th.
RFC patches sent for review only are obviously welcome at any time.
--
pw-bot: defer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ipconfig: replace strncpy with strscpy
2025-06-07 16:42 ` Simon Horman
@ 2025-06-11 14:12 ` Pranav Tyagi
0 siblings, 0 replies; 3+ messages in thread
From: Pranav Tyagi @ 2025-06-11 14:12 UTC (permalink / raw)
To: Simon Horman
Cc: davem, dsahern, edumazet, kuba, pabeni, skhan, netdev,
linux-kernel, linux-kernel-mentees
On Sat, Jun 7, 2025 at 10:12 PM Simon Horman <horms@kernel.org> wrote:
>
> On Sat, Jun 07, 2025 at 08:58:30PM +0530, Pranav Tyagi wrote:
> > Replace the deprecated strncpy() with strscpy() as the destination
> > buffer is NUL-terminated and does not require any
> > trailing NUL-padding. Also increase the length to 252
> > as NUL-termination is guaranteed.
> >
> > Signed-off-by: Pranav Tyagi <pranav.tyagi03@gmail.com>
>
> Hi Pranav,
>
> As a non-bug fix for Networking code this should be targeted
> at net-next. And it's helpful to do so explicitly in the patch subject,
> like this:
>
> [PATCH v2 net-next] ...
>
> Also, unfortunately the timing of this patch is not good
> as net-next is currently closed for the merge window.
>
> You can find more information about the above,
> and other aspects of the workflow for the Networking subsystem
> in https://docs.kernel.org/process/maintainer-netdev.html
>
>
> ## Form letter - net-next-closed
>
> The merge window for v6.16 has begun and therefore net-next is closed
> for new drivers, features, code refactoring and optimizations. We are
> currently accepting bug fixes only.
>
> Please repost when net-next reopens after June 8th.
>
> RFC patches sent for review only are obviously welcome at any time.
>
> --
> pw-bot: defer
Hi,
Thanks for pointing out the shortcomings in the patch.
The doc will help a lot. I will correct the patch accordingly and
send the v2 as the merge window has reopened.
Regards
Pranav Tyagi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-11 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-07 15:28 [PATCH] net: ipconfig: replace strncpy with strscpy Pranav Tyagi
2025-06-07 16:42 ` Simon Horman
2025-06-11 14:12 ` Pranav Tyagi
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).