summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFiona Trahe <fiona.trahe@intel.com>2018-10-27 01:43:07 +0100
committerAkhil Goyal <akhil.goyal@nxp.com>2018-11-02 12:25:39 +0100
commit30fadd8bc9d4b550f854a5c76ee62bf02fea8b3e (patch)
tree5cb35f10ab7f94a12d8c691cbe7652f107e8471e /lib
parent1fca14d7dd4fed32e67cb2622546552c57b00c38 (diff)
downloaddpdk-30fadd8bc9d4b550f854a5c76ee62bf02fea8b3e.zip
dpdk-30fadd8bc9d4b550f854a5c76ee62bf02fea8b3e.tar.gz
dpdk-30fadd8bc9d4b550f854a5c76ee62bf02fea8b3e.tar.xz
compressdev: fix op allocation
Fixed bad logic in rte_comp_op_alloc() checking return value from rte_comp_op_raw_bulk_alloc(). This could have resulted in a seg-fault in error case. Made rte_comp_ob_bulk_alloc() code consistent with rte_comp_op_alloc(). Fixes: 96086db5a369 ("compressdev: add operation management") Cc: stable@dpdk.org Reported-by: Sabyasachi Sengupta <sabyasg@hpe.com> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com> Acked-by: Shally Verma <shally.verma@caviumnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_compressdev/rte_comp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/librte_compressdev/rte_comp.c b/lib/librte_compressdev/rte_comp.c
index c663be5..4634c12 100644
--- a/lib/librte_compressdev/rte_comp.c
+++ b/lib/librte_compressdev/rte_comp.c
@@ -174,7 +174,7 @@ rte_comp_op_alloc(struct rte_mempool *mempool)
int retval;
retval = rte_comp_op_raw_bulk_alloc(mempool, &op, 1);
- if (unlikely(retval < 0))
+ if (unlikely(retval != 1))
return NULL;
rte_comp_op_reset(op);
@@ -186,12 +186,12 @@ int __rte_experimental
rte_comp_op_bulk_alloc(struct rte_mempool *mempool,
struct rte_comp_op **ops, uint16_t nb_ops)
{
- int ret;
+ int retval;
uint16_t i;
- ret = rte_comp_op_raw_bulk_alloc(mempool, ops, nb_ops);
- if (unlikely(ret < nb_ops))
- return ret;
+ retval = rte_comp_op_raw_bulk_alloc(mempool, ops, nb_ops);
+ if (unlikely(retval != nb_ops))
+ return 0;
for (i = 0; i < nb_ops; i++)
rte_comp_op_reset(ops[i]);