common/idpf/base: fix possible null dereference

Coverity is reporting FORWARD_NULL issue when msg.ctx.indirect.payload
is NULL. Adding NULL check for this.

Coverity issue: 381689
Fixes: fb4ac04e9b ("common/idpf: introduce common library")

Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
Mingxia Liu 2022-11-09 05:17:07 +00:00 committed by Qi Zhang
parent 4138a5a28f
commit e50a35edbe

View File

@ -234,6 +234,8 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
e->desc.ret_val = msg.status;
e->desc.datalen = msg.data_len;
if (msg.data_len > 0) {
if (!msg.ctx.indirect.payload)
return -EINVAL;
e->buf_len = msg.data_len;
msg_data_len = msg.data_len;
idpf_memcpy(e->msg_buf, msg.ctx.indirect.payload->va, msg_data_len,