diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-13 20:31:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-29 15:40:23 -0400 |
commit | 3dc20cb282ec03cc4c997130d680c800011ed479 (patch) | |
tree | d8374e58a433a144c571e193cb0b024374ee0b6a /fs/binfmt_elf_fdpic.c | |
parent | 3af0761307d04f6b9a4626fb80011a22c143d75e (diff) |
new helper: read_code()
switch binfmts that use ->read() to that (and to kernel_read()
in several cases in binfmt_flat - sure, it's nommu, but still,
doing ->read() into kmalloc'ed buffer...)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/binfmt_elf_fdpic.c')
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 9c13e023e2b7..2711d9901632 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -926,7 +926,6 @@ static int elf_fdpic_map_file_constdisp_on_uclinux( | |||
926 | struct elf32_fdpic_loadseg *seg; | 926 | struct elf32_fdpic_loadseg *seg; |
927 | struct elf32_phdr *phdr; | 927 | struct elf32_phdr *phdr; |
928 | unsigned long load_addr, base = ULONG_MAX, top = 0, maddr = 0, mflags; | 928 | unsigned long load_addr, base = ULONG_MAX, top = 0, maddr = 0, mflags; |
929 | loff_t fpos; | ||
930 | int loop, ret; | 929 | int loop, ret; |
931 | 930 | ||
932 | load_addr = params->load_addr; | 931 | load_addr = params->load_addr; |
@@ -964,14 +963,12 @@ static int elf_fdpic_map_file_constdisp_on_uclinux( | |||
964 | if (params->phdrs[loop].p_type != PT_LOAD) | 963 | if (params->phdrs[loop].p_type != PT_LOAD) |
965 | continue; | 964 | continue; |
966 | 965 | ||
967 | fpos = phdr->p_offset; | ||
968 | |||
969 | seg->addr = maddr + (phdr->p_vaddr - base); | 966 | seg->addr = maddr + (phdr->p_vaddr - base); |
970 | seg->p_vaddr = phdr->p_vaddr; | 967 | seg->p_vaddr = phdr->p_vaddr; |
971 | seg->p_memsz = phdr->p_memsz; | 968 | seg->p_memsz = phdr->p_memsz; |
972 | 969 | ||
973 | ret = file->f_op->read(file, (void *) seg->addr, | 970 | ret = read_code(file, seg->addr, phdr->p_offset, |
974 | phdr->p_filesz, &fpos); | 971 | phdr->p_filesz); |
975 | if (ret < 0) | 972 | if (ret < 0) |
976 | return ret; | 973 | return ret; |
977 | 974 | ||