diff options
author | Jeff Layton <jlayton@redhat.com> | 2014-04-05 08:45:57 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-04-05 09:25:42 -0400 |
commit | 9581a4ae75517099bc87e1c43d1a8f35b55741b9 (patch) | |
tree | be0688b7e4af19715e11f82f83f86664a61e9116 /fs/nfs/dir.c | |
parent | e911b8158ee1def8153849b1641b736026b036e0 (diff) |
nfs: pass string length to pr_notice message about readdir loops
There is no guarantee that the strings in the nfs_cache_array will be
NULL-terminated. In the event that we end up hitting a readdir loop, we
need to ensure that we pass the warning message the length of the
string.
Reported-by: Lachlan McIlroy <lmcilroy@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r-- | fs/nfs/dir.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index b31f5d2400bd..ef3fd090f59a 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -313,10 +313,9 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des | |||
313 | if (printk_ratelimit()) { | 313 | if (printk_ratelimit()) { |
314 | pr_notice("NFS: directory %pD2 contains a readdir loop." | 314 | pr_notice("NFS: directory %pD2 contains a readdir loop." |
315 | "Please contact your server vendor. " | 315 | "Please contact your server vendor. " |
316 | "The file: %s has duplicate cookie %llu\n", | 316 | "The file: %.*s has duplicate cookie %llu\n", |
317 | desc->file, | 317 | desc->file, array->array[i].string.len, |
318 | array->array[i].string.name, | 318 | array->array[i].string.name, *desc->dir_cookie); |
319 | *desc->dir_cookie); | ||
320 | } | 319 | } |
321 | status = -ELOOP; | 320 | status = -ELOOP; |
322 | goto out; | 321 | goto out; |