summaryrefslogtreecommitdiff
path: root/net/sunrpc/cache.c
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2017-02-07 16:50:32 +0300
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2017-02-09 01:02:47 +0300
commit8ccc869169d0c59d288b20ec2b060317f87e08b4 (patch)
tree12a720592ebbd756f35f0ede7c1d210119c653b0 /net/sunrpc/cache.c
parent3f373e81b1e8d26a90523cd12385cbce588f3f18 (diff)
downloadlinux-8ccc869169d0c59d288b20ec2b060317f87e08b4.tar.xz
sunrpc: use simple_read_from_buffer for reading cache flush
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc/cache.c')
-rw-r--r--net/sunrpc/cache.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 9e8561d1714d..2f06f510b570 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1427,20 +1427,11 @@ static ssize_t read_flush(struct file *file, char __user *buf,
struct cache_detail *cd)
{
char tbuf[22];
- unsigned long p = *ppos;
size_t len;
- snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time));
- len = strlen(tbuf);
- if (p >= len)
- return 0;
- len -= p;
- if (len > count)
- len = count;
- if (copy_to_user(buf, (void*)(tbuf+p), len))
- return -EFAULT;
- *ppos += len;
- return len;
+ len = snprintf(tbuf, sizeof(tbuf), "%lu\n",
+ convert_to_wallclock(cd->flush_time));
+ return simple_read_from_buffer(buf, count, ppos, tbuf, len);
}
static ssize_t write_flush(struct file *file, const char __user *buf,