Commit 912eebeb authored by Jack Xu's avatar Jack Xu Committed by Herbert Xu

crypto: qat - add check for null pointer

Add null pointer check when freeing the memory for firmware.
Signed-off-by: default avatarJack Xu <jack.xu@intel.com>
Co-developed-by: default avatarWojciech Ziemba <wojciech.ziemba@intel.com>
Signed-off-by: default avatarWojciech Ziemba <wojciech.ziemba@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 4f1e9415
......@@ -1233,10 +1233,14 @@ static int qat_uclo_simg_alloc(struct icp_qat_fw_loader_handle *handle,
static void qat_uclo_simg_free(struct icp_qat_fw_loader_handle *handle,
struct icp_firml_dram_desc *dram_desc)
{
if (handle && dram_desc && dram_desc->dram_base_addr_v) {
dma_free_coherent(&handle->pci_dev->dev,
(size_t)(dram_desc->dram_size),
dram_desc->dram_base_addr_v,
dram_desc->dram_bus_addr);
}
if (dram_desc)
memset(dram_desc, 0, sizeof(*dram_desc));
}
......@@ -1245,12 +1249,14 @@ static void qat_uclo_ummap_auth_fw(struct icp_qat_fw_loader_handle *handle,
{
struct icp_firml_dram_desc dram_desc;
if (*desc) {
dram_desc.dram_base_addr_v = *desc;
dram_desc.dram_bus_addr = ((struct icp_qat_auth_chunk *)
(*desc))->chunk_bus_addr;
dram_desc.dram_size = ((struct icp_qat_auth_chunk *)
(*desc))->chunk_size;
qat_uclo_simg_free(handle, &dram_desc);
}
}
static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment