From 176670e31a156358cd8f2ac6ee4a5eb0dd74f54f Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Tue, 4 Jun 2019 15:13:46 -0600 Subject: [PATCH] drivers/amd/agesa: Assert that StdHeader is non-null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Coverity believes there is a path where StdHeader is possibly null. This *should* be incorrect, since the header is actually initialized through the module dispatch framework, though Coverity can't see it due to the extensive type-punning. However, the control flow is so dizzingly complicated that I'm not even completely sure, so adding an extra assert to be careful won't hurt anyway. Change-Id: If3d7c5d5c5bba846e7453b3dbc824e2208d749fb Signed-off-by: Jacob Garber Found-by: Coverity CID 1379932 Reviewed-on: https://review.coreboot.org/c/coreboot/+/33214 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Kyösti Mälkki --- src/drivers/amd/agesa/state_machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/amd/agesa/state_machine.c b/src/drivers/amd/agesa/state_machine.c index c8529c5e04..750d192325 100644 --- a/src/drivers/amd/agesa/state_machine.c +++ b/src/drivers/amd/agesa/state_machine.c @@ -272,7 +272,7 @@ int agesa_execute_state(struct sysinfo *cb, AGESA_STRUCT_NAME func) /* Must call the function buffer was allocated for.*/ AMD_CONFIG_PARAMS *StdHeader = aip.NewStructPtr; - ASSERT(StdHeader->Func == func); + ASSERT(StdHeader != NULL && StdHeader->Func == func); if (CONFIG(AGESA_EXTRA_TIMESTAMPS) && task.ts_entry_id) timestamp_add_now(task.ts_entry_id);