On 03/14/2018 03:28 PM, Josh Poimboeuf wrote: > On Tue, Mar 13, 2018 at 04:54:47PM +0100, Petr Mladek wrote: > >> diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h >> index 4754f01c1abb..fc7c64ce0992 100644 >> --- a/include/linux/livepatch.h >> +++ b/include/linux/livepatch.h >> @@ -186,11 +186,20 @@ static inline bool klp_have_reliable_stack(void) >> IS_ENABLED(CONFIG_HAVE_RELIABLE_STACKTRACE); >> } >> >> +struct klp_shadow; > > Why is this forward struct declaration needed? Compiles ok w/o it, so shouldn't be needed. >> @@ -150,6 +145,23 @@ static void *__klp_shadow_get_or_alloc(void *obj, unsigned long id, void *data, >> goto exists; >> } >> >> + new_shadow->obj = obj; >> + new_shadow->id = id; >> + >> + if (init_func) { >> + int err; >> + >> + err = init_func(obj, new_shadow->data, init_data); > > Am I hallucinating, or will new_shadow->data always be NULL? How did it > even work before? > struct klp_shadow { struct hlist_node node; struct rcu_head rcu_head; void *obj; unsigned long id; char data[]; << not a pointer }; In the past, this function would allocate the klp_shadow struct size accordingly, then memcpy in its data contents. This patch pushes the responsibility of data initialization out to the init_func(). -- Joe -- To unsubscribe from this list: send the line "unsubscribe live-patching" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html