cpu/x86/smm: Add overflow check
Rather bail out than run into undefined behavior. Change-Id: Ife26a0abed0ce6bcafe1e7cd8f499618631c4df4 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38763 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: <cedarhouse1@comcast.net>
This commit is contained in:
parent
fbdd18b650
commit
6d5f007813
|
@ -202,6 +202,8 @@ static int smm_module_setup_stub(void *smbase, struct smm_loader_params *params,
|
||||||
/* Adjust remaining size to account for save state. */
|
/* Adjust remaining size to account for save state. */
|
||||||
total_save_state_size = params->per_cpu_save_state_size *
|
total_save_state_size = params->per_cpu_save_state_size *
|
||||||
params->num_concurrent_save_states;
|
params->num_concurrent_save_states;
|
||||||
|
if (total_save_state_size > size)
|
||||||
|
return -1;
|
||||||
size -= total_save_state_size;
|
size -= total_save_state_size;
|
||||||
|
|
||||||
/* The save state size encroached over the first SMM entry point. */
|
/* The save state size encroached over the first SMM entry point. */
|
||||||
|
|
Loading…
Reference in New Issue