diff options
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r-- | fs/binfmt_elf.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 06435f3665f4..79b05a1a4365 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1152,7 +1152,7 @@ static int dump_write(struct file *file, const void *addr, int nr) | |||
1152 | static int dump_seek(struct file *file, loff_t off) | 1152 | static int dump_seek(struct file *file, loff_t off) |
1153 | { | 1153 | { |
1154 | if (file->f_op->llseek && file->f_op->llseek != no_llseek) { | 1154 | if (file->f_op->llseek && file->f_op->llseek != no_llseek) { |
1155 | if (file->f_op->llseek(file, off, 1) != off) | 1155 | if (file->f_op->llseek(file, off, SEEK_CUR) < 0) |
1156 | return 0; | 1156 | return 0; |
1157 | } else { | 1157 | } else { |
1158 | char *buf = (char *)get_zeroed_page(GFP_KERNEL); | 1158 | char *buf = (char *)get_zeroed_page(GFP_KERNEL); |
@@ -1220,7 +1220,7 @@ static int notesize(struct memelfnote *en) | |||
1220 | 1220 | ||
1221 | static int alignfile(struct file *file, loff_t *foffset) | 1221 | static int alignfile(struct file *file, loff_t *foffset) |
1222 | { | 1222 | { |
1223 | char buf[4] = { 0, }; | 1223 | static const char buf[4] = { 0, }; |
1224 | DUMP_WRITE(buf, roundup(*foffset, 4) - *foffset, foffset); | 1224 | DUMP_WRITE(buf, roundup(*foffset, 4) - *foffset, foffset); |
1225 | return 1; | 1225 | return 1; |
1226 | } | 1226 | } |
@@ -1569,7 +1569,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) | |||
1569 | 1569 | ||
1570 | DUMP_WRITE(elf, sizeof(*elf)); | 1570 | DUMP_WRITE(elf, sizeof(*elf)); |
1571 | offset += sizeof(*elf); /* Elf header */ | 1571 | offset += sizeof(*elf); /* Elf header */ |
1572 | offset += (segs+1) * sizeof(struct elf_phdr); /* Program headers */ | 1572 | offset += (segs + 1) * sizeof(struct elf_phdr); /* Program headers */ |
1573 | foffset = offset; | ||
1573 | 1574 | ||
1574 | /* Write notes phdr entry */ | 1575 | /* Write notes phdr entry */ |
1575 | { | 1576 | { |
@@ -1586,8 +1587,6 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) | |||
1586 | DUMP_WRITE(&phdr, sizeof(phdr)); | 1587 | DUMP_WRITE(&phdr, sizeof(phdr)); |
1587 | } | 1588 | } |
1588 | 1589 | ||
1589 | foffset = offset; | ||
1590 | |||
1591 | dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE); | 1590 | dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE); |
1592 | 1591 | ||
1593 | /* Write program headers for segments dump */ | 1592 | /* Write program headers for segments dump */ |
@@ -1612,7 +1611,6 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) | |||
1612 | phdr.p_align = ELF_EXEC_PAGESIZE; | 1611 | phdr.p_align = ELF_EXEC_PAGESIZE; |
1613 | 1612 | ||
1614 | DUMP_WRITE(&phdr, sizeof(phdr)); | 1613 | DUMP_WRITE(&phdr, sizeof(phdr)); |
1615 | foffset += sizeof(phdr); | ||
1616 | } | 1614 | } |
1617 | 1615 | ||
1618 | #ifdef ELF_CORE_WRITE_EXTRA_PHDRS | 1616 | #ifdef ELF_CORE_WRITE_EXTRA_PHDRS |