Skip to content

Commit

Permalink
nfs: pass string length to pr_notice message about readdir loops
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jeff Layton <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
jtlayton authored and trondmypd committed Apr 5, 2014
1 parent e911b81 commit 9581a4a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,9 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des
if (printk_ratelimit()) {
pr_notice("NFS: directory %pD2 contains a readdir loop."
"Please contact your server vendor. "
"The file: %s has duplicate cookie %llu\n",
desc->file,
array->array[i].string.name,
*desc->dir_cookie);
"The file: %.*s has duplicate cookie %llu\n",
desc->file, array->array[i].string.len,
array->array[i].string.name, *desc->dir_cookie);
}
status = -ELOOP;
goto out;
Expand Down

0 comments on commit 9581a4a

Please sign in to comment.