x86/tboot: check return value of dmar_table allocation

The allocation can just return NULL. Return an error value early instead
of crashing later on.

Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Hongyan Xia authored and Jan Beulich committed 2020-03-24 10:44:22 +01:00
1 parent f10df652c7
commit daed26bb7f
1 file changed
+2
+2
View File
@@ -480,6 +480,8 @@ int __init tboot_parse_dmar_table(acpi_table_handler dmar_handler)
sizeof(dmar_table_length),
pa + sizeof(char) * ACPI_NAME_SIZE);
dmar_table = xmalloc_bytes(dmar_table_length);
if ( !dmar_table )
return -ENOMEM;
tboot_copy_memory(dmar_table, dmar_table_length, pa);
clear_fixmap(FIX_TBOOT_MAP_ADDRESS);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.