> -----Original Message----- > From: Chen Ni <nichen@xxxxxxxxxxx> > Sent: Monday, April 8, 2024 7:29 AM > To: bbrezillon@xxxxxxxxxx; arno@xxxxxxxxxxxx; Srujana Challa > <schalla@xxxxxxxxxxx>; herbert@xxxxxxxxxxxxxxxxxxx; > davem@xxxxxxxxxxxxx > Cc: linux-crypto@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Chen Ni > <nichen@xxxxxxxxxxx> > Subject: [EXTERNAL] [PATCH] 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: e92971117c2c ("crypto: octeontx2 - add ctx_val workaround") > Signed-off-by: Chen Ni <nichen@xxxxxxxxxxx> > --- > drivers/crypto/marvell/octeontx2/cn10k_cpt.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/crypto/marvell/octeontx2/cn10k_cpt.c > b/drivers/crypto/marvell/octeontx2/cn10k_cpt.c > index 79b4e74804f6..6bfc59e67747 100644 > --- a/drivers/crypto/marvell/octeontx2/cn10k_cpt.c > +++ b/drivers/crypto/marvell/octeontx2/cn10k_cpt.c > @@ -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; > + } Thanks for fixing, Reviewed-by: Bharat Bhushan <bbhushan2@xxxxxxxxxxx> > > cn10k_cpt_hw_ctx_set(hctx, 1); > er_ctx->hw_ctx = hctx; > -- > 2.25.1 >