Skip to content

Commit 4ddea2f

Browse files
committed
modpost: do not call get_modinfo() for vmlinux(.o)
The three calls of get_modinfo() ("license", "import_ns", "version") always return NULL for vmlinux(.o) because the built-in module info is prefixed with __MODULE_INFO_PREFIX. It is harmless to call get_modinfo(), but there is no point to search for what apparently does not exist. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent f693153 commit 4ddea2f

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

scripts/mod/modpost.c

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,25 +2006,26 @@ static void read_symbols(const char *modname)
20062006
mod->skip = 1;
20072007
}
20082008

2009-
license = get_modinfo(&info, "license");
2010-
if (!license && !is_vmlinux(modname))
2011-
warn("missing MODULE_LICENSE() in %s\n"
2012-
"see include/linux/module.h for "
2013-
"more information\n", modname);
2014-
while (license) {
2015-
if (license_is_gpl_compatible(license))
2016-
mod->gpl_compatible = 1;
2017-
else {
2018-
mod->gpl_compatible = 0;
2019-
break;
2009+
if (!is_vmlinux(modname)) {
2010+
license = get_modinfo(&info, "license");
2011+
if (!license)
2012+
warn("missing MODULE_LICENSE() in %s\n", modname);
2013+
while (license) {
2014+
if (license_is_gpl_compatible(license))
2015+
mod->gpl_compatible = 1;
2016+
else {
2017+
mod->gpl_compatible = 0;
2018+
break;
2019+
}
2020+
license = get_next_modinfo(&info, "license", license);
20202021
}
2021-
license = get_next_modinfo(&info, "license", license);
2022-
}
20232022

2024-
namespace = get_modinfo(&info, "import_ns");
2025-
while (namespace) {
2026-
add_namespace(&mod->imported_namespaces, namespace);
2027-
namespace = get_next_modinfo(&info, "import_ns", namespace);
2023+
namespace = get_modinfo(&info, "import_ns");
2024+
while (namespace) {
2025+
add_namespace(&mod->imported_namespaces, namespace);
2026+
namespace = get_next_modinfo(&info, "import_ns",
2027+
namespace);
2028+
}
20282029
}
20292030

20302031
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
@@ -2065,10 +2066,12 @@ static void read_symbols(const char *modname)
20652066
if (!is_vmlinux(modname) || vmlinux_section_warnings)
20662067
check_sec_ref(mod, modname, &info);
20672068

2068-
version = get_modinfo(&info, "version");
2069-
if (version || (all_versions && !is_vmlinux(modname)))
2070-
get_src_version(modname, mod->srcversion,
2071-
sizeof(mod->srcversion)-1);
2069+
if (!is_vmlinux(modname)) {
2070+
version = get_modinfo(&info, "version");
2071+
if (version || all_versions)
2072+
get_src_version(modname, mod->srcversion,
2073+
sizeof(mod->srcversion) - 1);
2074+
}
20722075

20732076
parse_elf_finish(&info);
20742077

0 commit comments

Comments
 (0)