Re: [PATCH 1/2] livepatch: Initialize shadow variables by init function safely

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux