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>
This commit is contained in:
parent
88ae4ab980
commit
a008393951
|
@ -137,6 +137,7 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
|
||||||
char *name;
|
char *name;
|
||||||
char fullname[80], *buf;
|
char fullname[80], *buf;
|
||||||
struct elf_note en;
|
struct elf_note en;
|
||||||
|
size_t skip;
|
||||||
|
|
||||||
buf = (void *)get_zeroed_page(GFP_KERNEL);
|
buf = (void *)get_zeroed_page(GFP_KERNEL);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
|
@ -171,8 +172,8 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!dump_skip(cprm,
|
skip = roundup(cprm->file->f_pos - total + sz, 4) - cprm->file->f_pos;
|
||||||
roundup(cprm->written - total + sz, 4) - cprm->written))
|
if (!dump_skip(cprm, skip))
|
||||||
goto Eio;
|
goto Eio;
|
||||||
out:
|
out:
|
||||||
free_page((unsigned long)buf);
|
free_page((unsigned long)buf);
|
||||||
|
|
|
@ -2273,7 +2273,7 @@ static int elf_core_dump(struct coredump_params *cprm)
|
||||||
goto end_coredump;
|
goto end_coredump;
|
||||||
|
|
||||||
/* Align to page */
|
/* Align to page */
|
||||||
if (!dump_skip(cprm, dataoff - cprm->written))
|
if (!dump_skip(cprm, dataoff - cprm->file->f_pos))
|
||||||
goto end_coredump;
|
goto end_coredump;
|
||||||
|
|
||||||
for (i = 0, vma = first_vma(current, gate_vma); vma != NULL;
|
for (i = 0, vma = first_vma(current, gate_vma); vma != NULL;
|
||||||
|
|
|
@ -1787,7 +1787,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
|
||||||
goto end_coredump;
|
goto end_coredump;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dump_skip(cprm, dataoff - cprm->written))
|
if (!dump_skip(cprm, dataoff - cprm->file->f_pos))
|
||||||
goto end_coredump;
|
goto end_coredump;
|
||||||
|
|
||||||
if (!elf_fdpic_dump_segments(cprm))
|
if (!elf_fdpic_dump_segments(cprm))
|
||||||
|
|
|
@ -782,7 +782,7 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
|
||||||
struct file *file = cprm->file;
|
struct file *file = cprm->file;
|
||||||
loff_t pos = file->f_pos;
|
loff_t pos = file->f_pos;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
if (cprm->written + nr > cprm->limit)
|
if (pos + nr > cprm->limit)
|
||||||
return 0;
|
return 0;
|
||||||
while (nr) {
|
while (nr) {
|
||||||
if (dump_interrupted())
|
if (dump_interrupted())
|
||||||
|
@ -791,7 +791,6 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
file->f_pos = pos;
|
file->f_pos = pos;
|
||||||
cprm->written += n;
|
|
||||||
nr -= n;
|
nr -= n;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -803,12 +802,11 @@ int dump_skip(struct coredump_params *cprm, size_t nr)
|
||||||
static char zeroes[PAGE_SIZE];
|
static char zeroes[PAGE_SIZE];
|
||||||
struct file *file = cprm->file;
|
struct file *file = cprm->file;
|
||||||
if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
|
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;
|
return 0;
|
||||||
if (dump_interrupted() ||
|
if (dump_interrupted() ||
|
||||||
file->f_op->llseek(file, nr, SEEK_CUR) < 0)
|
file->f_op->llseek(file, nr, SEEK_CUR) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
cprm->written += nr;
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
while (nr > PAGE_SIZE) {
|
while (nr > PAGE_SIZE) {
|
||||||
|
@ -823,7 +821,7 @@ EXPORT_SYMBOL(dump_skip);
|
||||||
|
|
||||||
int dump_align(struct coredump_params *cprm, int align)
|
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))
|
if (align & (align - 1))
|
||||||
return 0;
|
return 0;
|
||||||
return mod ? dump_skip(cprm, align - mod) : 1;
|
return mod ? dump_skip(cprm, align - mod) : 1;
|
||||||
|
|
|
@ -64,7 +64,6 @@ struct coredump_params {
|
||||||
struct file *file;
|
struct file *file;
|
||||||
unsigned long limit;
|
unsigned long limit;
|
||||||
unsigned long mm_flags;
|
unsigned long mm_flags;
|
||||||
loff_t written;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user