History

module: move check_modinfo() early to early_mod_check()

This moves check_modinfo() to early_mod_check(). This doesn't make any functional changes either, as check_modinfo() was the first call on layout_and_allocate(), so we're just moving it back one routine and at the end. This let's us keep separate the checkers from the allocator.

Luis Chamberlain committed 3 years ago

Commit 02da2cb1 parent 85e6f611 file · +4 −4Browse files

Showing the changes to kernel/module (1 of 1 file). Show all

Unified · Split

kernel/module/main.c+4−4
@@ -2273,10 +2273,6 @@ static struct module *layout_and_allocate(struct load_info *info, int flags) · 2272 unmodified lines
22732273 unsigned int ndx;
22742274 int err;
22752275
2276− err = check_modinfo(info->mod, info, flags);
2277− if (err)
2278− return ERR_PTR(err);
2279−
22802276 /* Allow arches to frob section contents and sizes. */
22812277 err = module_frob_arch_sections(info->hdr, info->sechdrs,
22822278 info->secstrings, info->mod);
@@ -2690,6 +2686,10 @@ static int early_mod_check(struct load_info *info, int flags) · 407 unmodified lines
26902686 if (!check_modstruct_version(info, info->mod))
26912687 return -ENOEXEC;
26922688
2689+ err = check_modinfo(info->mod, info, flags);
2690+ if (err)
2691+ return err;
2692+
26932693 return 0;
26942694 }
26952695