diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 2dc739add5bb..45a28754d9ab 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -758,6 +758,7 @@ static void check_section(const char *modname, struct elf_info *elf, const char *sec = sech_name(elf, sechdr); if (sechdr->sh_type == SHT_PROGBITS && + sechdr->sh_size > 0 && !(sechdr->sh_flags & SHF_ALLOC) && !match(sec, section_white_list)) { warn("%s (%s): unexpected non-allocatable section.\n"