[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181017203107.lirzlz2sulntauqq@treble>
Date: Wed, 17 Oct 2018 15:31:07 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Petr Mladek <pmladek@...e.com>
Cc: Jiri Kosina <jikos@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
Jason Baron <jbaron@...mai.com>,
Joe Lawrence <joe.lawrence@...hat.com>,
Evgenii Shatokhin <eshatokhin@...tuozzo.com>,
live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
Jessica Yu <jeyu@...nel.org>
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
Powered by blists - more mailing lists