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>
This commit is contained in:
parent
261758b5c3
commit
e06b64050e
|
@ -695,8 +695,9 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
|
||||||
if (rv)
|
if (rv)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
sprintf(buf, "%d\n", nfsd_nrthreads());
|
|
||||||
return strlen(buf);
|
return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%d\n",
|
||||||
|
nfsd_nrthreads());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1197,7 +1198,9 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
|
||||||
nfsd_max_blksize = bsize;
|
nfsd_max_blksize = bsize;
|
||||||
mutex_unlock(&nfsd_mutex);
|
mutex_unlock(&nfsd_mutex);
|
||||||
}
|
}
|
||||||
return sprintf(buf, "%d\n", nfsd_max_blksize);
|
|
||||||
|
return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%d\n",
|
||||||
|
nfsd_max_blksize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NFSD_V4
|
#ifdef CONFIG_NFSD_V4
|
||||||
|
@ -1221,8 +1224,9 @@ static ssize_t __write_leasetime(struct file *file, char *buf, size_t size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
nfs4_reset_lease(lease);
|
nfs4_reset_lease(lease);
|
||||||
}
|
}
|
||||||
sprintf(buf, "%ld\n", nfs4_lease_time());
|
|
||||||
return strlen(buf);
|
return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n",
|
||||||
|
nfs4_lease_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue