mirror of https://github.com/torvalds/linux.git
coredump: reflow dump helpers a little
They look rather messy right now. Link: https://lore.kernel.org/20250516-work-coredump-socket-v8-3-664f3caf2516@kernel.org Acked-by: Luca Boccassi <luca.boccassi@gmail.com> Reviewed-by: Jann Horn <jannh@google.com> Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
d4fde206ab
commit
1c587ee610
|
|
@ -864,10 +864,9 @@ static 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)
|
||||
return 0;
|
||||
|
||||
|
||||
if (dump_interrupted())
|
||||
return 0;
|
||||
n = __kernel_write(file, addr, nr, &pos);
|
||||
|
|
@ -884,21 +883,22 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr)
|
|||
{
|
||||
static char zeroes[PAGE_SIZE];
|
||||
struct file *file = cprm->file;
|
||||
|
||||
if (file->f_mode & FMODE_LSEEK) {
|
||||
if (dump_interrupted() ||
|
||||
vfs_llseek(file, nr, SEEK_CUR) < 0)
|
||||
if (dump_interrupted() || vfs_llseek(file, nr, SEEK_CUR) < 0)
|
||||
return 0;
|
||||
cprm->pos += nr;
|
||||
return 1;
|
||||
} else {
|
||||
}
|
||||
|
||||
while (nr > PAGE_SIZE) {
|
||||
if (!__dump_emit(cprm, zeroes, PAGE_SIZE))
|
||||
return 0;
|
||||
nr -= PAGE_SIZE;
|
||||
}
|
||||
|
||||
return __dump_emit(cprm, zeroes, nr);
|
||||
}
|
||||
}
|
||||
|
||||
int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue