Commit 6a6d6a3a authored by Chen Ni's avatar Chen Ni Committed by Herbert Xu

crypto: octeontx2 - add missing check for dma_map_single

Add check for dma_map_single() and return error if it fails in order
to avoid invalid dma address.

Fixes: e9297111 ("crypto: octeontx2 - add ctx_val workaround")
Signed-off-by: default avatarChen Ni <nichen@iscas.ac.cn>
Reviewed-by: default avatarBharat Bhushan <bbhushan2@marvell.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 751fb252
......@@ -138,6 +138,10 @@ int cn10k_cpt_hw_ctx_init(struct pci_dev *pdev,
return -ENOMEM;
cptr_dma = dma_map_single(&pdev->dev, hctx, CN10K_CPT_HW_CTX_SIZE,
DMA_BIDIRECTIONAL);
if (dma_mapping_error(&pdev->dev, cptr_dma)) {
kfree(hctx);
return -ENOMEM;
}
cn10k_cpt_hw_ctx_set(hctx, 1);
er_ctx->hw_ctx = hctx;
......
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