[RFC PATCH v4 2/4] livepatch: Call klp_init_patch_early() earlier

Yafang Shao <[email protected]>
Newsgroups org.kernel.vger.live-patching
Message-ID <[email protected]>
Invoke klp_init_patch_early() during early initialization to avoid
mixing for_each_() and for_each_*_static() variants later in the code.

No functional change. This prepares the code for an upcoming patch.

Suggested-by: Petr Mladek <[email protected]>
Signed-off-by: Yafang Shao <[email protected]>
---
 kernel/livepatch/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 0ad778d1006f..5ec30909d382 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -1145,6 +1145,8 @@ int klp_enable_patch(struct klp_patch *patch)
 
 	mutex_lock(&klp_mutex);
 
+	klp_init_patch_early(patch);
+
 	if (!klp_is_patch_compatible(patch)) {
 		pr_err("Livepatch patch (%s) is not compatible with the already installed livepatches.\n",
 			patch->mod->name);
@@ -1157,8 +1159,6 @@ int klp_enable_patch(struct klp_patch *patch)
 		return -ENODEV;
 	}
 
-	klp_init_patch_early(patch);
-
 	ret = klp_init_patch(patch);
 	if (ret)
 		goto err;
-- 
2.52.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.