diff options
author | David S. Miller <davem@davemloft.net> | 2016-04-09 23:41:41 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-09 23:41:41 +0200 |
commit | ae95d7126104591348d37aaf78c8325967e02386 (patch) | |
tree | 3270712f030549d77d4c55246d056e02b9def29d /arch/mips/kernel/module-rela.c | |
parent | ipv6: fix inet6_lookup_listener() (diff) | |
parent | Merge tag 'tty-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/greg... (diff) | |
download | linux-ae95d7126104591348d37aaf78c8325967e02386.tar.xz linux-ae95d7126104591348d37aaf78c8325967e02386.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'arch/mips/kernel/module-rela.c')
-rw-r--r-- | arch/mips/kernel/module-rela.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/arch/mips/kernel/module-rela.c b/arch/mips/kernel/module-rela.c index 2b70723071c3..9083d63b765c 100644 --- a/arch/mips/kernel/module-rela.c +++ b/arch/mips/kernel/module-rela.c @@ -109,9 +109,10 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, struct module *me) { Elf_Mips_Rela *rel = (void *) sechdrs[relsec].sh_addr; + int (*handler)(struct module *me, u32 *location, Elf_Addr v); Elf_Sym *sym; u32 *location; - unsigned int i; + unsigned int i, type; Elf_Addr v; int res; @@ -134,9 +135,21 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, return -ENOENT; } - v = sym->st_value + rel[i].r_addend; + type = ELF_MIPS_R_TYPE(rel[i]); + + if (type < ARRAY_SIZE(reloc_handlers_rela)) + handler = reloc_handlers_rela[type]; + else + handler = NULL; - res = reloc_handlers_rela[ELF_MIPS_R_TYPE(rel[i])](me, location, v); + if (!handler) { + pr_err("%s: Unknown relocation type %u\n", + me->name, type); + return -EINVAL; + } + + v = sym->st_value + rel[i].r_addend; + res = handler(me, location, v); if (res) return res; } |