summaryrefslogtreecommitdiffstats
path: root/fs/coredump.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2016-05-11 15:16:36 -0700
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-12 16:55:50 -0400
commita00839395103d5e2d132a6c4a9680256580ed3d1 (patch)
treef45b3fdcdfcf65d722d3cf083527f876ebd1ea0d /fs/coredump.c
parent88ae4ab9802eaa8e400e611f85883143d89d6b61 (diff)
downloadlinux-a00839395103d5e2d132a6c4a9680256580ed3d1.tar.bz2
coredump: get rid of coredump_params->written
cprm->written is redundant with cprm->file->f_pos, so use that instead. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/coredump.c')
-rw-r--r--fs/coredump.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/coredump.c b/fs/coredump.c
index 47c32c3bfa1d..9db0c514438e 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -782,7 +782,7 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
struct file *file = cprm->file;
loff_t pos = file->f_pos;
ssize_t n;
- if (cprm->written + nr > cprm->limit)
+ if (pos + nr > cprm->limit)
return 0;
while (nr) {
if (dump_interrupted())
@@ -791,7 +791,6 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
if (n <= 0)
return 0;
file->f_pos = pos;
- cprm->written += n;
nr -= n;
}
return 1;
@@ -803,12 +802,11 @@ int dump_skip(struct coredump_params *cprm, size_t nr)
static char zeroes[PAGE_SIZE];
struct file *file = cprm->file;
if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
- if (cprm->written + nr > cprm->limit)
+ if (file->f_pos + nr > cprm->limit)
return 0;
if (dump_interrupted() ||
file->f_op->llseek(file, nr, SEEK_CUR) < 0)
return 0;
- cprm->written += nr;
return 1;
} else {
while (nr > PAGE_SIZE) {
@@ -823,7 +821,7 @@ EXPORT_SYMBOL(dump_skip);
int dump_align(struct coredump_params *cprm, int align)
{
- unsigned mod = cprm->written & (align - 1);
+ unsigned mod = cprm->file->f_pos & (align - 1);
if (align & (align - 1))
return 0;
return mod ? dump_skip(cprm, align - mod) : 1;