Commit e1a1ccef authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'livepatching-for-6.2' of...

Merge tag 'livepatching-for-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching

Pull livepatching update from Petr Mladek:

 - code cleanup

* tag 'livepatching-for-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching:
  livepatch: Move the result-invariant calculation out of the loop
parents a312a8cc 53910ef7
...@@ -196,36 +196,36 @@ static int klp_check_stack_func(struct klp_func *func, unsigned long *entries, ...@@ -196,36 +196,36 @@ static int klp_check_stack_func(struct klp_func *func, unsigned long *entries,
struct klp_ops *ops; struct klp_ops *ops;
int i; int i;
for (i = 0; i < nr_entries; i++) { if (klp_target_state == KLP_UNPATCHED) {
address = entries[i]; /*
* Check for the to-be-unpatched function
* (the func itself).
*/
func_addr = (unsigned long)func->new_func;
func_size = func->new_size;
} else {
/*
* Check for the to-be-patched function
* (the previous func).
*/
ops = klp_find_ops(func->old_func);
if (klp_target_state == KLP_UNPATCHED) { if (list_is_singular(&ops->func_stack)) {
/* /* original function */
* Check for the to-be-unpatched function func_addr = (unsigned long)func->old_func;
* (the func itself). func_size = func->old_size;
*/
func_addr = (unsigned long)func->new_func;
func_size = func->new_size;
} else { } else {
/* /* previously patched function */
* Check for the to-be-patched function struct klp_func *prev;
* (the previous func).
*/ prev = list_next_entry(func, stack_node);
ops = klp_find_ops(func->old_func); func_addr = (unsigned long)prev->new_func;
func_size = prev->new_size;
if (list_is_singular(&ops->func_stack)) {
/* original function */
func_addr = (unsigned long)func->old_func;
func_size = func->old_size;
} else {
/* previously patched function */
struct klp_func *prev;
prev = list_next_entry(func, stack_node);
func_addr = (unsigned long)prev->new_func;
func_size = prev->new_size;
}
} }
}
for (i = 0; i < nr_entries; i++) {
address = entries[i];
if (address >= func_addr && address < func_addr + func_size) if (address >= func_addr && address < func_addr + func_size)
return -EAGAIN; return -EAGAIN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment