mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 05:02:24 +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);
|
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);
|
size = read(fd, madt, file_state.st_size);
|
||||||
if (size == file_state.st_size) {
|
if (size == file_state.st_size) {
|
||||||
ret = local_parse_madt(madt);
|
ret = local_parse_madt(madt);
|
||||||
|
Loading…
Reference in New Issue
Block a user