summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-05-12 14:28:05 -0700
committerSage Weil <sage@newdream.net>2011-05-19 11:25:02 -0700
commitae598083015e22d1802617c18d3408971b1bddc0 (patch)
tree3aba3bf823153f0e9fd8a8748b1acfdc5ab10e34 /fs/ceph
parente8f54ce169125a2e59330fac25ad3c9ac0ce22a5 (diff)
downloadop-kernel-dev-ae598083015e22d1802617c18d3408971b1bddc0.zip
op-kernel-dev-ae598083015e22d1802617c18d3408971b1bddc0.tar.gz
ceph: use snprintf for dirstat content
We allocate a buffer for rstats if the dirstat option is enabled. Use snprintf. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/dir.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 1a867a3..53a5eb4 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1066,16 +1066,17 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
struct inode *inode = file->f_dentry->d_inode;
struct ceph_inode_info *ci = ceph_inode(inode);
int left;
+ const int bufsize = 1024;
if (!ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
return -EISDIR;
if (!cf->dir_info) {
- cf->dir_info = kmalloc(1024, GFP_NOFS);
+ cf->dir_info = kmalloc(bufsize, GFP_NOFS);
if (!cf->dir_info)
return -ENOMEM;
cf->dir_info_len =
- sprintf(cf->dir_info,
+ snprintf(cf->dir_info, bufsize,
"entries: %20lld\n"
" files: %20lld\n"
" subdirs: %20lld\n"
OpenPOWER on IntegriCloud