mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen/arm: Directly return NULL if Xen fails to allocate domain struct
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>
This commit is contained in:
1 parent
46b5f0fd1f
commit
ea527eda9e
1 file changed
+4
-2
@@ -409,8 +409,10 @@ struct domain *alloc_domain_struct(void)
|
||||
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;
|
||||
}
|
||||
|
||||