mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 13:08:42 +00:00
hv: add NULL-pointer check for security
Added a check to prevent NULL-pointer dereference when parsing PTCT. Tracked-On: #5330 Signed-off-by: Qian Wang <qian1.wang@intel.com>
This commit is contained in:
parent
dec8c09d04
commit
928bc38bf6
@ -11,6 +11,7 @@
|
||||
|
||||
uint64_t psram_area_bottom;
|
||||
uint64_t psram_area_top;
|
||||
volatile bool psram_is_initialized = false;
|
||||
|
||||
#ifdef CONFIG_PTCM_ENABLED
|
||||
|
||||
@ -28,9 +29,14 @@ static void parse_ptct(void)
|
||||
struct ptct_entry_data_psram *psram_entry;
|
||||
struct ptct_entry_data_ptcm_binary* ptcm_binary_entry;
|
||||
struct acpi_table_ptct* acpi_ptct = (struct acpi_table_ptct *)get_acpi_tbl(ACPI_SIG_PTCT);
|
||||
|
||||
if (acpi_ptct == NULL){
|
||||
pr_fatal("Cannot find PTCT pointer!!!!");
|
||||
}
|
||||
else {
|
||||
pr_info("found PTCT subtable in HPA %llx, length: %d", acpi_ptct, acpi_ptct->header.length);
|
||||
|
||||
entry = &acpi_ptct->ptct_first_entry; //&acpi_ptct->ptct_entries[0];
|
||||
entry = &acpi_ptct->ptct_first_entry;
|
||||
|
||||
psram_area_bottom = PSRAM_BASE_HPA;
|
||||
|
||||
@ -97,13 +103,13 @@ static void parse_ptct(void)
|
||||
}
|
||||
psram_area_top = round_page_up(psram_area_top);
|
||||
psram_area_bottom = round_page_down(psram_area_bottom);
|
||||
}
|
||||
}
|
||||
|
||||
static volatile uint64_t ptcm_command_interface_offset;
|
||||
static volatile struct ptct_entry* ptct_base_entry;
|
||||
static volatile ptcm_command_abi ptcm_command_interface = NULL;
|
||||
/* psram_is_initialized is used to tell whether psram is successfully initialized for all cores */
|
||||
static volatile bool psram_is_initialized = false;
|
||||
|
||||
int32_t init_psram(bool is_bsp)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user