]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
modpost: fix inverted logic in is_extable_fault_address().
authorQuentin Casasnovas <quentin.casasnovas@oracle.com>
Thu, 16 Apr 2015 03:33:32 +0000 (13:03 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 22 Apr 2015 08:01:31 +0000 (17:31 +0930)
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>
scripts/mod/modpost.c

index 22dbc604cdb9eaa037742e59baa455dd73d80d4c..93bb87d0e17d1a2c5defd0c05e1d8571181c84e4 100644 (file)
@@ -1529,7 +1529,12 @@ static void find_extable_entry_size(const char* const sec, const Elf_Rela* r,
 }
 static inline bool is_extable_fault_address(Elf_Rela *r)
 {
-       if (!extable_entry_size == 0)
+       /*
+        * extable_entry_size is only discovered after we've handled the
+        * _second_ relocation in __ex_table, so only abort when we're not
+        * handling the first reloc and extable_entry_size is zero.
+        */
+       if (r->r_offset && extable_entry_size == 0)
                fatal("extable_entry size hasn't been discovered!\n");
 
        return ((r->r_offset == 0) ||