tree: Handle NULL pointer returned by smm_get_save_state()
Since commit 64d9e85681
("cpu/x86/smm_module_hander: Set up a save state map"), the
smm_get_save_state() function can return a NULL pointer. Therefore, it
is crucial to ensure that code properly handles the potential for a
NULL pointer return value from smm_get_save_state().
Change-Id: Ie263393ca7d9d6b5e9868c5f73240fc788116cd0
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86040
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
parent
0cf6a4d702
commit
41124035a8
6 changed files with 12 additions and 0 deletions
|
|
@ -33,6 +33,8 @@ static void *find_save_state(int cmd)
|
|||
/* Check all nodes looking for the one that issued the IO */
|
||||
for (core = 0; core < CONFIG_MAX_CPUS; core++) {
|
||||
state = smm_get_save_state(core);
|
||||
if (!state)
|
||||
continue;
|
||||
smm_io_trap = state->smm_io_trap_offset;
|
||||
/* Check for Valid IO Trap Word (bit1==1) */
|
||||
if (!(smm_io_trap & SMM_IO_TRAP_VALID))
|
||||
|
|
|
|||
|
|
@ -176,6 +176,8 @@ static em64t100_smm_state_save_area_t *smi_apmc_find_state_save(uint8_t cmd)
|
|||
/* Check all nodes looking for the one that issued the IO */
|
||||
for (node = 0; node < CONFIG_MAX_CPUS; node++) {
|
||||
state = smm_get_save_state(node);
|
||||
if (!state)
|
||||
continue;
|
||||
|
||||
/* Check for Synchronous IO (bit0==1) */
|
||||
if (!(state->io_misc_info & (1 << 0)))
|
||||
|
|
|
|||
|
|
@ -228,6 +228,8 @@ static em64t101_smm_state_save_area_t *smi_apmc_find_state_save(u8 cmd)
|
|||
/* Check all nodes looking for the one that issued the IO */
|
||||
for (node = 0; node < CONFIG_MAX_CPUS; node++) {
|
||||
state = smm_get_save_state(node);
|
||||
if (!state)
|
||||
continue;
|
||||
|
||||
/* Check for Synchronous IO (bit0 == 1) */
|
||||
if (!(state->io_misc_info & (1 << 0)))
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ static em64t100_smm_state_save_area_t *smi_apmc_find_state_save(uint8_t cmd)
|
|||
/* Check all nodes looking for the one that issued the IO */
|
||||
for (node = 0; node < CONFIG_MAX_CPUS; node++) {
|
||||
state = smm_get_save_state(node);
|
||||
if (!state)
|
||||
continue;
|
||||
|
||||
/* Check for Synchronous IO (bit0==1) */
|
||||
if (!(state->io_misc_info & (1 << 0)))
|
||||
|
|
|
|||
|
|
@ -205,6 +205,8 @@ static em64t101_smm_state_save_area_t *smi_apmc_find_state_save(u8 cmd)
|
|||
/* Check all nodes looking for the one that issued the IO */
|
||||
for (node = 0; node < CONFIG_MAX_CPUS; node++) {
|
||||
state = smm_get_save_state(node);
|
||||
if (!state)
|
||||
continue;
|
||||
|
||||
/* Check for Synchronous IO (bit0 == 1) */
|
||||
if (!(state->io_misc_info & (1 << 0)))
|
||||
|
|
|
|||
|
|
@ -177,6 +177,8 @@ static em64t101_smm_state_save_area_t *smi_apmc_find_state_save(u8 cmd)
|
|||
/* Check all nodes looking for the one that issued the IO */
|
||||
for (node = 0; node < CONFIG_MAX_CPUS; node++) {
|
||||
state = smm_get_save_state(node);
|
||||
if (!state)
|
||||
continue;
|
||||
|
||||
/* Check for Synchronous IO (bit0 == 1) */
|
||||
if (!(state->io_misc_info & (1 << 0)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue