diff options
| -rw-r--r-- | arch/powerpc/kernel/module_64.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 2c53de9f3b6a..8661eea78503 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
| @@ -680,7 +680,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
| 680 | 680 | ||
| 681 | case R_PPC64_REL32: | 681 | case R_PPC64_REL32: |
| 682 | /* 32 bits relative (used by relative exception tables) */ | 682 | /* 32 bits relative (used by relative exception tables) */ |
| 683 | *(u32 *)location = value - (unsigned long)location; | 683 | /* Convert value to relative */ |
| 684 | value -= (unsigned long)location; | ||
| 685 | if (value + 0x80000000 > 0xffffffff) { | ||
| 686 | pr_err("%s: REL32 %li out of range!\n", | ||
| 687 | me->name, (long int)value); | ||
| 688 | return -ENOEXEC; | ||
| 689 | } | ||
| 690 | *(u32 *)location = value; | ||
| 684 | break; | 691 | break; |
| 685 | 692 | ||
| 686 | case R_PPC64_TOCSAVE: | 693 | case R_PPC64_TOCSAVE: |
