diff options
Diffstat (limited to 'arch/mips/kernel/elf.c')
-rw-r--r-- | arch/mips/kernel/elf.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/arch/mips/kernel/elf.c b/arch/mips/kernel/elf.c index 5c429d70e17f..0828d6d963b7 100644 --- a/arch/mips/kernel/elf.c +++ b/arch/mips/kernel/elf.c | |||
@@ -87,6 +87,7 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf, | |||
87 | bool elf32; | 87 | bool elf32; |
88 | u32 flags; | 88 | u32 flags; |
89 | int ret; | 89 | int ret; |
90 | loff_t pos; | ||
90 | 91 | ||
91 | elf32 = ehdr->e32.e_ident[EI_CLASS] == ELFCLASS32; | 92 | elf32 = ehdr->e32.e_ident[EI_CLASS] == ELFCLASS32; |
92 | flags = elf32 ? ehdr->e32.e_flags : ehdr->e64.e_flags; | 93 | flags = elf32 ? ehdr->e32.e_flags : ehdr->e64.e_flags; |
@@ -108,21 +109,16 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf, | |||
108 | 109 | ||
109 | if (phdr32->p_filesz < sizeof(abiflags)) | 110 | if (phdr32->p_filesz < sizeof(abiflags)) |
110 | return -EINVAL; | 111 | return -EINVAL; |
111 | 112 | pos = phdr32->p_offset; | |
112 | ret = kernel_read(elf, phdr32->p_offset, | ||
113 | (char *)&abiflags, | ||
114 | sizeof(abiflags)); | ||
115 | } else { | 113 | } else { |
116 | if (phdr64->p_type != PT_MIPS_ABIFLAGS) | 114 | if (phdr64->p_type != PT_MIPS_ABIFLAGS) |
117 | return 0; | 115 | return 0; |
118 | if (phdr64->p_filesz < sizeof(abiflags)) | 116 | if (phdr64->p_filesz < sizeof(abiflags)) |
119 | return -EINVAL; | 117 | return -EINVAL; |
120 | 118 | pos = phdr64->p_offset; | |
121 | ret = kernel_read(elf, phdr64->p_offset, | ||
122 | (char *)&abiflags, | ||
123 | sizeof(abiflags)); | ||
124 | } | 119 | } |
125 | 120 | ||
121 | ret = kernel_read(elf, &abiflags, sizeof(abiflags), &pos); | ||
126 | if (ret < 0) | 122 | if (ret < 0) |
127 | return ret; | 123 | return ret; |
128 | if (ret != sizeof(abiflags)) | 124 | if (ret != sizeof(abiflags)) |