aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/livepatch/transition.c
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.com>2019-01-09 07:43:19 -0500
committerJiri Kosina <jkosina@suse.cz>2019-01-11 14:51:23 -0500
commit19514910d021c93c7823ec32067e6b7dea224f0f (patch)
tree3df053de0eb62fec2557e24bd807cae328d4f21a /kernel/livepatch/transition.c
parent1686cc1a31f45a3fd090e5d0c6fce777422e13fa (diff)
livepatch: Change unsigned long old_addr -> void *old_func in struct klp_func
The address of the to be patched function and new function is stored in struct klp_func as: void *new_func; unsigned long old_addr; The different naming scheme and type are derived from the way the addresses are set. @old_addr is assigned at runtime using kallsyms-based search. @new_func is statically initialized, for example: static struct klp_func funcs[] = { { .old_name = "cmdline_proc_show", .new_func = livepatch_cmdline_proc_show, }, { } }; This patch changes unsigned long old_addr -> void *old_func. It removes some confusion when these address are later used in the code. It is motivated by a followup patch that adds special NOP struct klp_func where we want to assign func->new_func = func->old_addr respectively func->new_func = func->old_func. This patch does not modify the existing behavior. Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Alice Ferrazzi <alice.ferrazzi@gmail.com> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'kernel/livepatch/transition.c')
-rw-r--r--kernel/livepatch/transition.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c
index 304d5eb8a98c..f27a378ad5e1 100644
--- a/kernel/livepatch/transition.c
+++ b/kernel/livepatch/transition.c
@@ -224,11 +224,11 @@ static int klp_check_stack_func(struct klp_func *func,
224 * Check for the to-be-patched function 224 * Check for the to-be-patched function
225 * (the previous func). 225 * (the previous func).
226 */ 226 */
227 ops = klp_find_ops(func->old_addr); 227 ops = klp_find_ops(func->old_func);
228 228
229 if (list_is_singular(&ops->func_stack)) { 229 if (list_is_singular(&ops->func_stack)) {
230 /* original function */ 230 /* original function */
231 func_addr = func->old_addr; 231 func_addr = (unsigned long)func->old_func;
232 func_size = func->old_size; 232 func_size = func->old_size;
233 } else { 233 } else {
234 /* previously patched function */ 234 /* previously patched function */