summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Zhao <john.zhao@intel.com>2021-07-06 10:28:18 -0700
committerFelix Held <felix-coreboot@felixheld.de>2021-07-08 15:47:53 +0000
commit270e25594faab04c4db402b47922af8740673777 (patch)
tree29663f6655096c1adf51d52fde405684afe5c712 /src
parentf96aa7a68780529fcef97dd207416cfcee9e68b9 (diff)
soc/intel/alderlake: Avoid NULL pointer deference
Coverity detects dereference pointers req and res that are NULL when calling the pmc_send_ipc_cmd function. This change prevents NULL pointers dereference. Found-by: Coverity CID 1458077, 1458078 TEST=None Signed-off-by: John Zhao <john.zhao@intel.com> Change-Id: I151157e7a9a90c43075f431933ac44f29fd25127 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56123 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/alderlake/crashlog.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/soc/intel/alderlake/crashlog.c b/src/soc/intel/alderlake/crashlog.c
index c1eeedffaa..9435aa092d 100644
--- a/src/soc/intel/alderlake/crashlog.c
+++ b/src/soc/intel/alderlake/crashlog.c
@@ -32,8 +32,8 @@ bool pmc_cl_discovery(void)
{
u32 tmp_bar_addr = 0, desc_table_addr = 0;
- const struct pmc_ipc_buffer *req = { 0 };
- struct pmc_ipc_buffer *res = NULL;
+ const struct pmc_ipc_buffer req = { 0 };
+ struct pmc_ipc_buffer res;
uint32_t cmd_reg;
int r;
@@ -42,13 +42,13 @@ bool pmc_cl_discovery(void)
PMC_IPC_CMD_SIZE_SHIFT);
printk(BIOS_DEBUG, "cmd_reg from pmc_make_ipc_cmd %d\n", cmd_reg);
- r = pmc_send_ipc_cmd(cmd_reg, req, res);
+ r = pmc_send_ipc_cmd(cmd_reg, &req, &res);
if (r < 0) {
printk(BIOS_ERR, "pmc_send_ipc_cmd failed in %s\n", __func__);
return false;
}
- discovery_buf.val_64_bits = ((u64)res->buf[1] << 32) | res->buf[0];
+ discovery_buf.val_64_bits = ((u64)res.buf[1] << 32) | res.buf[0];
if (discovery_buf.bits.supported != 1) {