diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 7d53942445d7..269bd79bcd9a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1098,7 +1098,9 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, sec_mismatch_count++; warn("%s: section mismatch in reference: %s+0x%x (section: %s) -> %s (section: %s)\n", - modname, fromsym, (unsigned int)(faddr - from->st_value), fromsec, tosym, tosec); + modname, fromsym, + (unsigned int)(faddr - (from ? from->st_value : 0)), + fromsec, tosym, tosec); if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) { if (match(tosec, mismatch->bad_tosec))