mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 12:42:54 +00:00
dm: fix add check for malloc result
Add check for malloc result to madt pointer. Tracked-On: #6769 Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
This commit is contained in:
parent
6db72de473
commit
a69bd56c05
@ -117,6 +117,11 @@ int parse_madt(void)
|
||||
}
|
||||
|
||||
madt = (struct acpi_table_madt *)malloc(file_state.st_size);
|
||||
if (madt == NULL) {
|
||||
pr_err("Failed to malloc %d bytes for MADT!\n", file_state.st_size);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
size = read(fd, madt, file_state.st_size);
|
||||
if (size == file_state.st_size) {
|
||||
ret = local_parse_madt(madt);
|
||||
|
Loading…
Reference in New Issue
Block a user