char *name;
char fullname[80], *buf;
struct elf_note en;
+ size_t skip;
buf = (void *)get_zeroed_page(GFP_KERNEL);
if (!buf)
if (rc < 0)
goto out;
- if (!dump_skip(cprm,
- roundup(cprm->written - total + sz, 4) - cprm->written))
+ skip = roundup(cprm->file->f_pos - total + sz, 4) - cprm->file->f_pos;
+ if (!dump_skip(cprm, skip))
goto Eio;
out:
free_page((unsigned long)buf);
goto end_coredump;
/* Align to page */
- if (!dump_skip(cprm, dataoff - cprm->written))
+ if (!dump_skip(cprm, dataoff - cprm->file->f_pos))
goto end_coredump;
for (i = 0, vma = first_vma(current, gate_vma); vma != NULL;
goto end_coredump;
}
- if (!dump_skip(cprm, dataoff - cprm->written))
+ if (!dump_skip(cprm, dataoff - cprm->file->f_pos))
goto end_coredump;
if (!elf_fdpic_dump_segments(cprm))
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())
if (n <= 0)
return 0;
file->f_pos = pos;
- cprm->written += n;
nr -= n;
}
return 1;
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) {
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;