lkml.org 
[lkml]   [2018]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2018-03-14 21:23    [W:0.051 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site