aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-04-23 19:33:25 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-04-28 13:54:30 -0400
commite06b64050ebea1220bca3c291d0431f5206b5c95 (patch)
tree8d24948cb2397ae456bdf0467b63fa41764759fe /fs
parent261758b5c3dfeac73ca364c47ed538f5ce4250ee (diff)
NFSD: Stricter buffer size checking in fs/nfsd/nfsctl.c
Clean up: For consistency, handle output buffer size checking in a other nfsctl functions the same way it's done for write_versions(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfsctl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index a152694e016e..877e713a0fd6 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -695,8 +695,9 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
695 if (rv) 695 if (rv)
696 return rv; 696 return rv;
697 } 697 }
698 sprintf(buf, "%d\n", nfsd_nrthreads()); 698
699 return strlen(buf); 699 return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%d\n",
700 nfsd_nrthreads());
700} 701}
701 702
702/** 703/**
@@ -1197,7 +1198,9 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
1197 nfsd_max_blksize = bsize; 1198 nfsd_max_blksize = bsize;
1198 mutex_unlock(&nfsd_mutex); 1199 mutex_unlock(&nfsd_mutex);
1199 } 1200 }
1200 return sprintf(buf, "%d\n", nfsd_max_blksize); 1201
1202 return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%d\n",
1203 nfsd_max_blksize);
1201} 1204}
1202 1205
1203#ifdef CONFIG_NFSD_V4 1206#ifdef CONFIG_NFSD_V4
@@ -1221,8 +1224,9 @@ static ssize_t __write_leasetime(struct file *file, char *buf, size_t size)
1221 return -EINVAL; 1224 return -EINVAL;
1222 nfs4_reset_lease(lease); 1225 nfs4_reset_lease(lease);
1223 } 1226 }
1224 sprintf(buf, "%ld\n", nfs4_lease_time()); 1227
1225 return strlen(buf); 1228 return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n",
1229 nfs4_lease_time());
1226} 1230}
1227 1231
1228/** 1232/**