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

Re: [Xen-devel] [PATCH 2/2] libxl: zero the vtpm structures on allocation



On Fri, 2013-04-12 at 15:23 +0100, Daniel De Graaf wrote:
> On 04/12/2013 10:10 AM, Ian Campbell wrote:
> > On Thu, 2013-03-14 at 14:23 +0000, Daniel De Graaf wrote:
> >> This avoids returning unallocated memory in the libxl_device_vtpm
> >> structure since libxl_device_vtpm_init is not called here.
> >
> > Does the code not either loop over ndirs and initialise every one or
> > alternatively fail and cleanup without returning the uninitialised
> > memory?
> 
> The code used to initialize every member and so did not call the _init
> function for vtpms; adding a new member to the structure causes this
> to miss the new member. An alternative to this patch is to add a call
> to libxl_device_vtpm_init inside the loop, similar the disk device type.

I think this is preferable since if a new member is added which doesn't
default to 0 then the memset is also wrong.

> The nic device just does memset(nic, 0, sizeof(*nic)), like this patch.

I think that's wrong.

> > If this is an issue it expect it is an issue for libxl_device_*_list?
> > Probably they should all be calling their respective init functions,
> > perhaps via a new libxl_..._init_array helper?
> 
> At least disk and nic handle this on a per-element basis, so there's no
> immediate advantage to an array helper.

OK then.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.