Messages in this thread | | | Date | Wed, 14 Mar 2018 15:22:29 -0500 | From | Josh Poimboeuf <> | Subject | Re: [PATCH 1/2] livepatch: Initialize shadow variables by init function safely |
| |
On Wed, Mar 14, 2018 at 03:43:01PM -0400, Joe Lawrence wrote: > >> @@ -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 > };
Ah. This code needs a nice comment above the kzalloc() call, so I won't get confused again next time.
-- Josh
| |