Re: [PATCH v4 1/3] livepatch: use lists to manage patches, objects and functions

From: Miroslav Benes
Date: Tue Oct 17 2017 - 08:00:46 EST



> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index b9628e4..b7f77be 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -608,6 +608,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
> INIT_LIST_HEAD(&func->stack_node);
> func->patched = false;
> func->transition = false;
> + list_add(&func->func_entry, &obj->func_list);

I doubt it matters much, but would list_add_tail() be better? The order
would then be the same in both linked list and static array.

> /* The format for the sysfs directory is <function,sympos> where sympos
> * is the nth occurrence of this symbol in kallsyms for the patched
> @@ -689,7 +690,9 @@ static int klp_init_object(struct klp_patch *patch, struct klp_object *obj)
> if (ret)
> return ret;
>
> - klp_for_each_func(obj, func) {
> + list_add(&obj->obj_entry, &patch->obj_list);

Here as well.

Miroslav