diff options
author | Trond Myklebust <trondmy@gmail.com> | 2020-02-02 17:57:07 -0500 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2020-02-03 16:35:07 -0500 |
commit | a8bd9ddf397be8e0d812ce3da4e40440ac25f6d0 (patch) | |
tree | a6abffd591fd5839936d4ce7e5f51b423c96e623 /fs/nfs | |
parent | 10717f45639f6c1bc27b56405252c3a027406d92 (diff) | |
download | linux-stable-a8bd9ddf397be8e0d812ce3da4e40440ac25f6d0.tar.gz linux-stable-a8bd9ddf397be8e0d812ce3da4e40440ac25f6d0.tar.bz2 linux-stable-a8bd9ddf397be8e0d812ce3da4e40440ac25f6d0.zip |
NFS: Replace various occurrences of kstrndup() with kmemdup_nul()
When we already know the string length, it is more efficient to
use kmemdup_nul().
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
[Anna - Changes to super.c were already made during fscontext conversion]
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/dns_resolve.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4namespace.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c index aec769a500a1..89bd5581f317 100644 --- a/fs/nfs/dns_resolve.c +++ b/fs/nfs/dns_resolve.c @@ -93,7 +93,7 @@ static void nfs_dns_ent_init(struct cache_head *cnew, key = container_of(ckey, struct nfs_dns_ent, h); kfree(new->hostname); - new->hostname = kstrndup(key->hostname, key->namelen, GFP_KERNEL); + new->hostname = kmemdup_nul(key->hostname, key->namelen, GFP_KERNEL); if (new->hostname) { new->namelen = key->namelen; nfs_dns_ent_update(cnew, ckey); diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 3ea1c1008b5b..84026e7b8a5f 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c @@ -501,7 +501,7 @@ static int nfs4_try_replacing_one_location(struct nfs_server *server, rpc_set_port(sap, NFS_PORT); error = -ENOMEM; - hostname = kstrndup(buf->data, buf->len, GFP_KERNEL); + hostname = kmemdup_nul(buf->data, buf->len, GFP_KERNEL); if (hostname == NULL) break; |