Jan Beulich
2011-Oct-14 07:26 UTC
[Xen-devel] p2m: use xzalloc() for struct p2m_domain allocation
Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -71,7 +71,6 @@ boolean_param("hap_2mb", opt_hap_2mb); /* Init the datastructures for later use by the p2m code */ static void p2m_initialise(struct domain *d, struct p2m_domain *p2m) { - memset(p2m, 0, sizeof(*p2m)); mm_lock_init(&p2m->lock); INIT_LIST_HEAD(&p2m->np2m_list); INIT_PAGE_LIST_HEAD(&p2m->pages); @@ -100,7 +99,7 @@ p2m_init_nestedp2m(struct domain *d) mm_lock_init(&d->arch.nested_p2m_lock); for (i = 0; i < MAX_NESTEDP2M; i++) { - d->arch.nested_p2m[i] = p2m = xmalloc(struct p2m_domain); + d->arch.nested_p2m[i] = p2m = xzalloc(struct p2m_domain); if (p2m == NULL) return -ENOMEM; p2m_initialise(d, p2m); @@ -115,7 +114,7 @@ int p2m_init(struct domain *d) { struct p2m_domain *p2m; - p2m_get_hostp2m(d) = p2m = xmalloc(struct p2m_domain); + p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain); if ( p2m == NULL ) return -ENOMEM; p2m_initialise(d, p2m); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2011-Oct-14 07:59 UTC
Re: [Xen-devel] p2m: use xzalloc() for struct p2m_domain allocation
On 14/10/2011 08:26, "Jan Beulich" <JBeulich@suse.com> wrote:> Signed-off-by: Jan Beulich <jbeulich@suse.com>I''ll leave this one for Tim to ack/nack.> --- a/xen/arch/x86/mm/p2m.c > +++ b/xen/arch/x86/mm/p2m.c > @@ -71,7 +71,6 @@ boolean_param("hap_2mb", opt_hap_2mb); > /* Init the datastructures for later use by the p2m code */ > static void p2m_initialise(struct domain *d, struct p2m_domain *p2m) > { > - memset(p2m, 0, sizeof(*p2m)); > mm_lock_init(&p2m->lock); > INIT_LIST_HEAD(&p2m->np2m_list); > INIT_PAGE_LIST_HEAD(&p2m->pages); > @@ -100,7 +99,7 @@ p2m_init_nestedp2m(struct domain *d) > > mm_lock_init(&d->arch.nested_p2m_lock); > for (i = 0; i < MAX_NESTEDP2M; i++) { > - d->arch.nested_p2m[i] = p2m = xmalloc(struct p2m_domain); > + d->arch.nested_p2m[i] = p2m = xzalloc(struct p2m_domain); > if (p2m == NULL) > return -ENOMEM; > p2m_initialise(d, p2m); > @@ -115,7 +114,7 @@ int p2m_init(struct domain *d) > { > struct p2m_domain *p2m; > > - p2m_get_hostp2m(d) = p2m = xmalloc(struct p2m_domain); > + p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain); > if ( p2m == NULL ) > return -ENOMEM; > p2m_initialise(d, p2m); > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2011-Oct-14 08:59 UTC
Re: [Xen-devel] p2m: use xzalloc() for struct p2m_domain allocation
At 08:59 +0100 on 14 Oct (1318582792), Keir Fraser wrote:> On 14/10/2011 08:26, "Jan Beulich" <JBeulich@suse.com> wrote: > > > Signed-off-by: Jan Beulich <jbeulich@suse.com> > > I''ll leave this one for Tim to ack/nack.Acked-by: Tim Deegan <tim@xen.org>> > --- a/xen/arch/x86/mm/p2m.c > > +++ b/xen/arch/x86/mm/p2m.c > > @@ -71,7 +71,6 @@ boolean_param("hap_2mb", opt_hap_2mb); > > /* Init the datastructures for later use by the p2m code */ > > static void p2m_initialise(struct domain *d, struct p2m_domain *p2m) > > { > > - memset(p2m, 0, sizeof(*p2m)); > > mm_lock_init(&p2m->lock); > > INIT_LIST_HEAD(&p2m->np2m_list); > > INIT_PAGE_LIST_HEAD(&p2m->pages); > > @@ -100,7 +99,7 @@ p2m_init_nestedp2m(struct domain *d) > > > > mm_lock_init(&d->arch.nested_p2m_lock); > > for (i = 0; i < MAX_NESTEDP2M; i++) { > > - d->arch.nested_p2m[i] = p2m = xmalloc(struct p2m_domain); > > + d->arch.nested_p2m[i] = p2m = xzalloc(struct p2m_domain); > > if (p2m == NULL) > > return -ENOMEM; > > p2m_initialise(d, p2m); > > @@ -115,7 +114,7 @@ int p2m_init(struct domain *d) > > { > > struct p2m_domain *p2m; > > > > - p2m_get_hostp2m(d) = p2m = xmalloc(struct p2m_domain); > > + p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain); > > if ( p2m == NULL ) > > return -ENOMEM; > > p2m_initialise(d, p2m); > > > > > > > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel