]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
kbuild: fix segfault in modpost
authorSam Ravnborg <sam@mars.ravnborg.org>
Sun, 19 Feb 2006 08:56:18 +0000 (09:56 +0100)
committerSam Ravnborg <sam@mars.ravnborg.org>
Sun, 19 Feb 2006 08:56:18 +0000 (09:56 +0100)
Do not try to look up section name until we know it is not a special
section. Otherwise we will address outside legal space and segfault.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
scripts/mod/modpost.c

index a7360c379cba75fa12adf78c1df7466fe59123c7..eeaf57476820e2f5b375debd0c69f7105e42b461 100644 (file)
@@ -576,11 +576,11 @@ static void check_sec_ref(struct module *mod, const char *modname,
                        r.r_offset = TO_NATIVE(rela->r_offset);
                        r.r_info   = TO_NATIVE(rela->r_info);
                        sym = elf->symtab_start + ELF_R_SYM(r.r_info);
-                       secname = secstrings + sechdrs[sym->st_shndx].sh_name;
                        /* Skip special sections */
                        if (sym->st_shndx >= SHN_LORESERVE)
                                continue;
 
+                       secname = secstrings + sechdrs[sym->st_shndx].sh_name;
                        if (section(secname))
                                warn_sec_mismatch(modname, name, elf, sym, r);
                }