From ee941635e668e48d704bbeef519b13b0b66ef38a Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sat, 6 Oct 2018 14:29:44 +0530 Subject: [PATCH] soc/intel/common/block/pcr: Add NULL pointer check in pcr_execute_sideband_msg() This patch to fix KW issue due to msg, data and response pointers NULL check fail. Change-Id: I39324514079f240ba1683a04e579de85485299bf Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/28949 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/soc/intel/common/block/pcr/pcr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/soc/intel/common/block/pcr/pcr.c b/src/soc/intel/common/block/pcr/pcr.c index b8d798ffe2..58eb13affa 100644 --- a/src/soc/intel/common/block/pcr/pcr.c +++ b/src/soc/intel/common/block/pcr/pcr.c @@ -263,7 +263,12 @@ int pcr_execute_sideband_msg(struct pcr_sbi_msg *msg, uint32_t *data, uint16_t sbi_status; uint16_t sbi_rid; - assert(msg && data && response); + if (!msg || !data || !response) { + printk(BIOS_ERR, "Pointer checked for NULL Fail! " + "msg = %p \t data = %p \t response = %p\n", + msg, data, response); + return -1; + } switch (msg->opcode) { case MEM_READ: @@ -275,7 +280,8 @@ int pcr_execute_sideband_msg(struct pcr_sbi_msg *msg, uint32_t *data, case GPIO_LOCK_UNLOCK: break; default: - printk(BIOS_ERR, "SBI Failure: Wrong Input!\n"); + printk(BIOS_ERR, "SBI Failure: Wrong Input = %x!\n", + msg->opcode); return -1; break; }