[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250411050613.10550-1-kevinpaul468@gmail.com>
Date: Fri, 11 Apr 2025 10:36:13 +0530
From: Kevin Paul Reddy Janagari <kevinpaul468@...il.com>
To: jmaloy@...hat.com
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
horms@...nel.org,
netdev@...r.kernel.org,
tipc-discussion@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
kevinpaul468@...il.com
Subject: [PATCH] Removing deprecated strncpy()
This patch suggests the replacement of strncpy with strscpy
as per Documentation/process/deprecated.
The strncpy() fails to guarntee NULL termination,
The function adds zero pads which isn't really convenient for short strings
as it may cause performce issues
strscpy() is a preffered replacement because
it overcomes the limitations of strncpy mentioned above
Compile Tested
Signed-off-by: Kevin Paul Reddy Janagari <kevinpaul468@...il.com>
---
net/tipc/node.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/tipc/node.c b/net/tipc/node.c
index ccf5e427f43e..cb43f2016a70 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1581,7 +1581,7 @@ int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 addr,
tipc_node_read_lock(node);
link = node->links[bearer_id].link;
if (link) {
- strncpy(linkname, tipc_link_name(link), len);
+ strscpy(linkname, tipc_link_name(link), len);
err = 0;
}
tipc_node_read_unlock(node);
--
2.39.5
Powered by blists - more mailing lists