crypto/cnxk: fix condition check
Checks
Commit Message
The value of ec_mdata cannot be NULL, instead check that value of
private_data_offset was set.
Fixes: c3a498c01121 ("crypto/cnxk: add event metadata set operation")
Coverity issue: 378861
Coverity issue: 378865
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 4 ++--
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
Comments
> Subject: [PATCH] crypto/cnxk: fix condition check
>
> The value of ec_mdata cannot be NULL, instead check that value of
> private_data_offset was set.
>
>
> Fixes: c3a498c01121 ("crypto/cnxk: add event metadata set operation")
> Coverity issue: 378861 Coverity issue: 378865
>
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
>
> > Subject: [PATCH] crypto/cnxk: fix condition check
> >
> > The value of ec_mdata cannot be NULL, instead check that value of
> > private_data_offset was set.
> >
> >
> > Fixes: c3a498c01121 ("crypto/cnxk: add event metadata set operation")
> > Coverity issue: 378861 Coverity issue: 378865
> >
> > Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
>
> Acked-by: Anoob Joseph <anoobj@marvell.com>
Applied to dpdk-next-crypto
Thanks.
@@ -363,10 +363,10 @@ cn10k_ca_meta_info_extract(struct rte_crypto_op *op,
uint8_t cdev_id;
uint16_t qp_id;
+ if (unlikely(op->private_data_offset == 0))
+ return -EINVAL;
ec_mdata = (union rte_event_crypto_metadata *)
((uint8_t *)op + op->private_data_offset);
- if (!ec_mdata)
- return -EINVAL;
rsp_info = &ec_mdata->response_info;
cdev_id = ec_mdata->request_info.cdev_id;
qp_id = ec_mdata->request_info.queue_pair_id;
@@ -419,10 +419,10 @@ cn9k_ca_meta_info_extract(struct rte_crypto_op *op,
uint8_t cdev_id;
uint16_t qp_id;
+ if (unlikely(op->private_data_offset == 0))
+ return -EINVAL;
ec_mdata = (union rte_event_crypto_metadata *)
((uint8_t *)op + op->private_data_offset);
- if (!ec_mdata)
- return -EINVAL;
rsp_info = &ec_mdata->response_info;
cdev_id = ec_mdata->request_info.cdev_id;
qp_id = ec_mdata->request_info.queue_pair_id;