diff options
author | Quentin Casasnovas <quentin.casasnovas@oracle.com> | 2015-04-15 23:33:32 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-04-22 04:01:31 -0400 |
commit | d3df4de7eb095cc4334759a5e65bf3bfb4be04f1 (patch) | |
tree | fec8a1ff01f17a9ede642bc14ba20b1578692d5d /scripts/mod/modpost.c | |
parent | 6c730bfc894f5d4989c2c1493512d3330402be94 (diff) |
modpost: fix inverted logic in is_extable_fault_address().
As Guenter pointed out, we want to assert that extable_entry_size has been
discovered and not the other way around. Moreover, this sanity check is
only valid when we're not dealing with the first relocation in __ex_table,
since we have not discovered the extable entry size at that point.
This was leading to a divide-by-zero on some architectures and make the
build fail.
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
CC: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r-- | scripts/mod/modpost.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 22dbc604cdb9..93bb87d0e17d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1529,7 +1529,12 @@ static void find_extable_entry_size(const char* const sec, const Elf_Rela* r, | |||
1529 | } | 1529 | } |
1530 | static inline bool is_extable_fault_address(Elf_Rela *r) | 1530 | static inline bool is_extable_fault_address(Elf_Rela *r) |
1531 | { | 1531 | { |
1532 | if (!extable_entry_size == 0) | 1532 | /* |
1533 | * extable_entry_size is only discovered after we've handled the | ||
1534 | * _second_ relocation in __ex_table, so only abort when we're not | ||
1535 | * handling the first reloc and extable_entry_size is zero. | ||
1536 | */ | ||
1537 | if (r->r_offset && extable_entry_size == 0) | ||
1533 | fatal("extable_entry size hasn't been discovered!\n"); | 1538 | fatal("extable_entry size hasn't been discovered!\n"); |
1534 | 1539 | ||
1535 | return ((r->r_offset == 0) || | 1540 | return ((r->r_offset == 0) || |