netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net: ipconfig: replace strncpy with strscpy
@ 2025-06-12 11:48 Pranav Tyagi
  2025-06-13 17:22 ` Simon Horman
  2025-06-14  1:16 ` Jakub Kicinski
  0 siblings, 2 replies; 4+ messages in thread
From: Pranav Tyagi @ 2025-06-12 11:48 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] 4+ messages in thread

* Re: [PATCH v2 net-next] net: ipconfig: replace strncpy with strscpy
  2025-06-12 11:48 [PATCH v2 net-next] net: ipconfig: replace strncpy with strscpy Pranav Tyagi
@ 2025-06-13 17:22 ` Simon Horman
  2025-06-14  1:16 ` Jakub Kicinski
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-06-13 17:22 UTC (permalink / raw)
  To: Pranav Tyagi
  Cc: davem, dsahern, edumazet, kuba, pabeni, skhan, netdev,
	linux-kernel, linux-kernel-mentees

On Thu, Jun 12, 2025 at 05:18:59PM +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,

Thanks for the updated patch.

I agree with your analysis above and that this patch is correct.

Reviewed-by: Simon Horman <horms@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net-next] net: ipconfig: replace strncpy with strscpy
  2025-06-12 11:48 [PATCH v2 net-next] net: ipconfig: replace strncpy with strscpy Pranav Tyagi
  2025-06-13 17:22 ` Simon Horman
@ 2025-06-14  1:16 ` Jakub Kicinski
  2025-07-05 14:22   ` Pranav Tyagi
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2025-06-14  1:16 UTC (permalink / raw)
  To: Pranav Tyagi
  Cc: davem, dsahern, edumazet, pabeni, horms, skhan, netdev,
	linux-kernel, linux-kernel-mentees

On Thu, 12 Jun 2025 17:18:59 +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.

Petr is making functional changes to this code:
https://lore.kernel.org/all/20250610143504.731114-1-petr.zejdl@cern.ch/
Please repost once his work is merged to avoid unnecessary conflicts
-- 
pw-bot: defer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net-next] net: ipconfig: replace strncpy with strscpy
  2025-06-14  1:16 ` Jakub Kicinski
@ 2025-07-05 14:22   ` Pranav Tyagi
  0 siblings, 0 replies; 4+ messages in thread
From: Pranav Tyagi @ 2025-07-05 14:22 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, dsahern, edumazet, pabeni, horms, skhan, netdev,
	linux-kernel, linux-kernel-mentees

On Sat, Jun 14, 2025 at 6:46 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 12 Jun 2025 17:18:59 +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.
>
> Petr is making functional changes to this code:
> https://lore.kernel.org/all/20250610143504.731114-1-petr.zejdl@cern.ch/
> Please repost once his work is merged to avoid unnecessary conflicts
> --
> pw-bot: defer

Hi,

I hope you're doing well.

I noticed that Petr’s patch has not seen any updates for some time now.
I wanted to kindly ask if it would be appropriate to repost my patch
at this point
or if I should continue to wait until his changes are merged.

Thank you for your time and guidance.

Regards
Pranav Tyagi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-05 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 11:48 [PATCH v2 net-next] net: ipconfig: replace strncpy with strscpy Pranav Tyagi
2025-06-13 17:22 ` Simon Horman
2025-06-14  1:16 ` Jakub Kicinski
2025-07-05 14:22   ` 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).