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
2273 unsigned int ndx;2273 unsigned int ndx;
2274 int err;2274 int err;
2275 2275
2276 err = check_modinfo(info->mod, info, flags);
2277 if (err)
2278 return ERR_PTR(err);
2279
2280 /* Allow arches to frob section contents and sizes. */2276 /* Allow arches to frob section contents and sizes. */
2281 err = module_frob_arch_sections(info->hdr, info->sechdrs,2277 err = module_frob_arch_sections(info->hdr, info->sechdrs,
2282 info->secstrings, info->mod);2278 info->secstrings, info->mod);
@@ -2690,6 +2686,10 @@ static int early_mod_check(struct load_info *info, int flags) · 407 unmodified lines
2690 if (!check_modstruct_version(info, info->mod))2686 if (!check_modstruct_version(info, info->mod))
2691 return -ENOEXEC;2687 return -ENOEXEC;
2692 2688
2689 err = check_modinfo(info->mod, info, flags);
2690 if (err)
2691 return err;
2692
2693 return 0;2693 return 0;
2694}2694}
2695 2695