diff options
author | John Zhao <john.zhao@intel.com> | 2021-07-06 10:51:16 -0700 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-09-08 22:01:11 +0000 |
commit | 8557613617e2c83bbe86ddf5226a84405b277bfc (patch) | |
tree | 1a95ed4a334f53269cffbbd0812d792743118e0f /src/soc/intel/common/block/crashlog | |
parent | 46719834010ce1f4c8ecbc12c9c52baa349ecf9d (diff) |
soc/intel/common: 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 1458068, 1458070, 1458971, 1458073, 1458075,
1458076
TEST=None
Signed-off-by: John Zhao <john.zhao@intel.com>
Change-Id: Ib88fa5f44dd33ad1ad2e763d79438b5c5b78acb4
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56124
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/soc/intel/common/block/crashlog')
-rw-r--r-- | src/soc/intel/common/block/crashlog/crashlog.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/soc/intel/common/block/crashlog/crashlog.c b/src/soc/intel/common/block/crashlog/crashlog.c index 433545af17..c3d0cfd469 100644 --- a/src/soc/intel/common/block/crashlog/crashlog.c +++ b/src/soc/intel/common/block/crashlog/crashlog.c @@ -194,8 +194,8 @@ bool __weak cpu_cl_discovery(void) int cl_pmc_re_arm_after_reset(void) { - 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; @@ -203,7 +203,7 @@ int cl_pmc_re_arm_after_reset(void) PMC_IPC_CMD_ID_CRASHLOG_RE_ARM_ON_RESET, PMC_IPC_CMD_SIZE_SHIFT); - 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__); @@ -217,8 +217,8 @@ int cl_pmc_re_arm_after_reset(void) /* Sends PMC IPC to clear CrashLog from PMC SSRAM area */ int cl_pmc_clear(void) { - 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; @@ -226,7 +226,7 @@ int cl_pmc_clear(void) PMC_IPC_CMD_ID_CRASHLOG_ERASE, PMC_IPC_CMD_SIZE_SHIFT); - 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__); @@ -244,8 +244,8 @@ int cl_pmc_clear(void) int cl_pmc_en_gen_on_all_reboot(void) { - 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; @@ -253,7 +253,7 @@ int cl_pmc_en_gen_on_all_reboot(void) PMC_IPC_CMD_ID_CRASHLOG_ON_RESET, PMC_IPC_CMD_SIZE_SHIFT); - 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__); |