mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 00:38:28 +00:00
replace malloc and memset with calloc
malloc: allocate a block of memory, the contents of the block are undefined. calloc: allocate a block of memory for an array of num elements and initializes all its bits to zero. Signed-off-by: yechunliang <yechunliangcn@163.com>
This commit is contained in:
@@ -208,9 +208,8 @@ static int register_hrhd_units(void)
|
||||
}
|
||||
|
||||
for (i = 0; i < info->drhd_count; i++) {
|
||||
drhd_rt = malloc(sizeof(struct dmar_drhd_rt));
|
||||
drhd_rt = calloc(1, sizeof(struct dmar_drhd_rt));
|
||||
ASSERT(drhd_rt != NULL, "");
|
||||
memset(drhd_rt, 0, sizeof(struct dmar_drhd_rt));
|
||||
drhd_rt->drhd = &info->drhd_units[i];
|
||||
dmar_register_hrhd(drhd_rt);
|
||||
}
|
||||
|
Reference in New Issue
Block a user