John Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56123 )
Change subject: soc/intel/alderlake: Avoid NULL pointer deference ......................................................................
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 --- M src/soc/intel/alderlake/crashlog.c 1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/23/56123/1
diff --git a/src/soc/intel/alderlake/crashlog.c b/src/soc/intel/alderlake/crashlog.c index c1eeedf..9435aa0 100644 --- a/src/soc/intel/alderlake/crashlog.c +++ b/src/soc/intel/alderlake/crashlog.c @@ -32,8 +32,8 @@ { 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 @@ 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) {