lockd: move from strlcpy with unused retval to strscpy
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 18 Aug 2022 21:01:16 +0000 (23:01 +0200)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 26 Sep 2022 18:02:20 +0000 (14:02 -0400)
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/host.c

index f802223e71abe530b4234ac2fa403e5a038e8978..cdc8e12cdac44e87642e24866a6ae71ceaf3ef7a 100644 (file)
@@ -164,7 +164,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni,
        host->h_addrbuf    = nsm->sm_addrbuf;
        host->net          = ni->net;
        host->h_cred       = get_cred(ni->cred);
-       strlcpy(host->nodename, utsname()->nodename, sizeof(host->nodename));
+       strscpy(host->nodename, utsname()->nodename, sizeof(host->nodename));
 
 out:
        return host;