The current implementation of alloc_domain_struct, dereference the newly
allocated pointer even if the allocation has failed.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
struct domain *d;
BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
d = alloc_xenheap_pages(0, 0);
- if ( d != NULL )
- clear_page(d);
+ if ( d == NULL )
+ return NULL;
+
+ clear_page(d);
d->arch.grant_table_gpfn = xmalloc_array(xen_pfn_t, max_nr_grant_frames);
return d;
}