]> git.droids-corp.org - dpdk.git/commitdiff
crypto/cnxk: fix condition check
authorVolodymyr Fialko <vfialko@marvell.com>
Thu, 9 Jun 2022 09:27:31 +0000 (11:27 +0200)
committerAkhil Goyal <gakhil@marvell.com>
Tue, 21 Jun 2022 18:04:49 +0000 (20:04 +0200)
The value of ec_mdata cannot be NULL, instead check that value of
private_data_offset was set.

Coverity issue: 378861, 378865
Fixes: 97ebfda82910 ("crypto/cnxk: add event metadata set operation")
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
drivers/crypto/cnxk/cn10k_cryptodev_ops.c
drivers/crypto/cnxk/cn9k_cryptodev_ops.c

index dd4c1d99d558b74cdd0008f9babeb4ae18a80051..c2046d8d390352bc0f9a9a79b1c7c06a24c9aa0f 100644 (file)
@@ -350,10 +350,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;
index ed25afeb64090b7efd97bddd841130d86538841c..9f697c79c36bd911cac76625669de35842ec2f35 100644 (file)
@@ -402,10 +402,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;