History

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.

Quentin Casasnovas committed 11 years ago

Commit d3df4de1 parent 6c730bf1 file · +6 −1Browse files

Unified · Split

scripts/mod/modpost.c+6−1
@@ -1529,7 +1529,12 @@ static void find_extable_entry_size(const char* const sec, const Elf_Rela* r, · 1528 unmodified lines
15291529 }
15301530 static inline bool is_extable_fault_address(Elf_Rela *r)
15311531 {
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)
15331538 fatal("extable_entry size hasn't been discovered!\n");
15341539
15351540 return ((r->r_offset == 0) ||