From: Sam Ravnborg Date: Sun, 19 Feb 2006 08:56:18 +0000 (+0100) Subject: kbuild: fix segfault in modpost X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8ea80ca4f583e377c902811d42626ccfce16913f;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git kbuild: fix segfault in modpost 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 --- diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index a7360c379cba..eeaf57476820 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -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); }