Commit 3803d672 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFS: Use kmemdup_nul() in nfs_readdir_make_qstr()

The directory strings stored in the readdir cache may be used with
printk(), so it is better to ensure they are nul-terminated.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: default avatarBenjamin Coddington <bcodding@redhat.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 114de382
...@@ -198,7 +198,7 @@ static ...@@ -198,7 +198,7 @@ static
int nfs_readdir_make_qstr(struct qstr *string, const char *name, unsigned int len) int nfs_readdir_make_qstr(struct qstr *string, const char *name, unsigned int len)
{ {
string->len = len; string->len = len;
string->name = kmemdup(name, len, GFP_KERNEL); string->name = kmemdup_nul(name, len, GFP_KERNEL);
if (string->name == NULL) if (string->name == NULL)
return -ENOMEM; return -ENOMEM;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment