diff options
| author | Kevin Paul Reddy Janagari <[email protected]> | 2025-04-11 08:50:10 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2025-04-15 11:37:14 +0000 |
| commit | 8c9b406ff470a8346232eec979dc84f518aabfd9 (patch) | |
| tree | 0f4475ef2f78d4fc2c02c1ea5351569529a0d36b /net/tipc/node.c | |
| parent | Merge branch 'net-dsa-mt7530-modernize-mib-handling-fix' (diff) | |
| download | kernel-8c9b406ff470a8346232eec979dc84f518aabfd9.tar.gz kernel-8c9b406ff470a8346232eec979dc84f518aabfd9.zip | |
tipc: Removing deprecated strncpy()
This patch suggests the replacement of strncpy with strscpy
as per Documentation/process/deprecated.
The strncpy() fails to guarantee NULL termination,
The function adds zero pads which isn't really convenient for short strings
as it may cause performance issues.
strscpy() is a preferred replacement because
it overcomes the limitations of strncpy mentioned above.
Compile Tested
Signed-off-by: Kevin Paul Reddy Janagari <[email protected]>
Reviewed-by: Tung Nguyen <[email protected]>
Tested-by: Tung Nguyen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/tipc/node.c')
| -rw-r--r-- | net/tipc/node.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |
