Messages in this thread | | | Date | Wed, 17 Oct 2018 15:31:07 -0500 | From | Josh Poimboeuf <> | Subject | Re: [PATCH v13 07/12] livepatch: Use lists to manage patches, objects and functions |
| |
On Mon, Oct 15, 2018 at 02:37:08PM +0200, Petr Mladek wrote: > +static int klp_init_lists(struct klp_patch *patch) > +{ > + struct klp_object *obj; > + struct klp_func *func; > + > + INIT_LIST_HEAD(&patch->obj_list); > + if (!patch->objs) > + return -EINVAL; > + > + klp_for_each_object_static(patch, obj) { > + list_add(&obj->node, &patch->obj_list); > + > + INIT_LIST_HEAD(&obj->func_list); > + if (!obj->funcs) > + return -EINVAL; > + > + klp_for_each_func_static(obj, func) > + list_add(&func->node, &obj->func_list); > + } > + > + return 0; > +}
It may be ever-so-slightly better to use list_add_tail() instead of list_add(), so the list order matches the array order. I doubt the ordering really matters, but you never know. It could for example make debugging a little easier in some scenarios.
-- Josh
| |