Skip to content

Commit

Permalink
x86/tboot: check return value of dmar_table allocation
Browse files Browse the repository at this point in the history
The allocation can just return NULL. Return an error value early instead
of crashing later on.

Signed-off-by: Hongyan Xia <[email protected]>
Reviewed-by: Jan Beulich <[email protected]>
  • Loading branch information
Hongyan Xia authored and jbeulich committed Mar 24, 2020
1 parent f10df65 commit daed26b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xen/arch/x86/tboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit daed26b

Please sign in to comment.