net/smc: replace strncpy with strscpy
Subsystems (5)
PATCH v2 1/1 net/smc: replace strncpy with strscpy
Replace the deprecated strncpy() with two-argument version of strscpy() as the destination is an array
and should be NUL-terminated.
Signed-off-by Pranav Tyagi <[email protected]>
--- net/smc/smc_pnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_pnet.c +1 -1
@@ -370,7 +370,7 @@ static int smc_pnet_add_eth(struct smc_pnettable *pnettable, struct net *net, goto out_put; new_pe->type =SMC_PNET_ETH ;memcpy (new_pe->pnet_name, pnet_name,SMC_MAX_PNETID_LEN ); -strncpy (new_pe->eth_name, eth_name,IFNAMSIZ ); +strscpy (new_pe->eth_name, eth_name); rc = -EEXIST ; new_netdev = true;mutex_lock (&pnettable->lock);
Signature · 1 line
2.49.0
Quoted 5 lines · Pranav Tyagi
Replace the deprecated
strncpy()with two-argument version ofstrscpy()as the destination is an array
and should be NUL-terminated.Signed-off-by Pranav Tyagi <[email protected]>
Thanks for the update.
Reviewed-by Simon Horman <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Fri, 20 Jun 2025 15:55:59 +0530 you wrote:
Replace the deprecated
strncpy()with two-argument version ofstrscpy()as the destination is an array
and should be NUL-terminated.Signed-off-by Pranav Tyagi <[email protected]>--- net/smc/smc_pnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [v2] net/smc: replace strncpy with strscpy
https://git.kernel.org/netdev/net-next/c/ae2402bf882b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html