* [dpdk-stable] [PATCH] lib/compressdev: Fix logic error on op allocation
@ 2018-10-27 0:17 Fiona Trahe
2018-10-27 0:31 ` Thomas Monjalon
2018-10-27 0:43 ` [dpdk-stable] [PATCH v2] " Fiona Trahe
0 siblings, 2 replies; 5+ messages in thread
From: Fiona Trahe @ 2018-10-27 0:17 UTC (permalink / raw)
To: dev
Cc: thomas, akhil.goyal, tomaszx.jozwiak, sabyasg, shally.verma,
Fiona Trahe, stable
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().
Thanks to Sabyasachi Sengupta for pointing it out.
Fixes: 96086db5a369 ("compressdev: add operation management")
Cc: stable@dpdk.org
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
lib/librte_compressdev/rte_comp.c | 10 +++++-----
1 file 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]);
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [PATCH] lib/compressdev: Fix logic error on op allocation
2018-10-27 0:17 [dpdk-stable] [PATCH] lib/compressdev: Fix logic error on op allocation Fiona Trahe
@ 2018-10-27 0:31 ` Thomas Monjalon
2018-10-27 0:43 ` [dpdk-stable] [PATCH v2] " Fiona Trahe
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2018-10-27 0:31 UTC (permalink / raw)
To: Fiona Trahe
Cc: dev, akhil.goyal, tomaszx.jozwiak, sabyasg, shally.verma, stable
27/10/2018 02:17, Fiona Trahe:
> 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().
>
> Thanks to Sabyasachi Sengupta for pointing it out.
In this case, you can add a tag Reported-by: on top of your Signed-off-by:
> Fixes: 96086db5a369 ("compressdev: add operation management")
> Cc: stable@dpdk.org
>
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-stable] [PATCH v2] lib/compressdev: Fix logic error on op allocation
2018-10-27 0:17 [dpdk-stable] [PATCH] lib/compressdev: Fix logic error on op allocation Fiona Trahe
2018-10-27 0:31 ` Thomas Monjalon
@ 2018-10-27 0:43 ` Fiona Trahe
2018-10-30 14:00 ` Verma, Shally
1 sibling, 1 reply; 5+ messages in thread
From: Fiona Trahe @ 2018-10-27 0:43 UTC (permalink / raw)
To: dev
Cc: thomas, akhil.goyal, tomaszx.jozwiak, sabyasg, shally.verma,
Fiona Trahe, stable
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>
---
v2 change:
- added Reported-by tag
lib/librte_compressdev/rte_comp.c | 10 +++++-----
1 file 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]);
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [PATCH v2] lib/compressdev: Fix logic error on op allocation
2018-10-27 0:43 ` [dpdk-stable] [PATCH v2] " Fiona Trahe
@ 2018-10-30 14:00 ` Verma, Shally
2018-11-02 11:42 ` [dpdk-stable] [dpdk-dev] " Akhil Goyal
0 siblings, 1 reply; 5+ messages in thread
From: Verma, Shally @ 2018-10-30 14:00 UTC (permalink / raw)
To: Fiona Trahe, dev; +Cc: thomas, akhil.goyal, tomaszx.jozwiak, sabyasg, stable
>-----Original Message-----
>From: Fiona Trahe <fiona.trahe@intel.com>
>Sent: 27 October 2018 06:13
>To: dev@dpdk.org
>Cc: thomas@monjalon.net; akhil.goyal@nxp.com; tomaszx.jozwiak@intel.com; sabyasg@hpe.com; Verma, Shally
><Shally.Verma@cavium.com>; Fiona Trahe <fiona.trahe@intel.com>; stable@dpdk.org
>Subject: [PATCH v2] lib/compressdev: Fix logic error on op allocation
>
>External Email
>
>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>
>---
>v2 change:
> - added Reported-by tag
>
> lib/librte_compressdev/rte_comp.c | 10 +++++-----
> 1 file 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]);
>--
>2.7.4
Acked-by: Shally Verma <Shally.Verma@caviumnetworks.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] lib/compressdev: Fix logic error on op allocation
2018-10-30 14:00 ` Verma, Shally
@ 2018-11-02 11:42 ` Akhil Goyal
0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2018-11-02 11:42 UTC (permalink / raw)
To: Verma, Shally, Fiona Trahe, dev; +Cc: thomas, tomaszx.jozwiak, sabyasg, stable
On 10/30/2018 7:30 PM, Verma, Shally wrote:
>
>> -----Original Message-----
>> From: Fiona Trahe <fiona.trahe@intel.com>
>> Sent: 27 October 2018 06:13
>> To: dev@dpdk.org
>> Cc: thomas@monjalon.net; akhil.goyal@nxp.com; tomaszx.jozwiak@intel.com; sabyasg@hpe.com; Verma, Shally
>> <Shally.Verma@cavium.com>; Fiona Trahe <fiona.trahe@intel.com>; stable@dpdk.org
>> Subject: [PATCH v2] lib/compressdev: Fix logic error on op allocation
>>
>> External Email
>>
>> 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>
>> ---
>> v2 change:
>> - added Reported-by tag
>>
>> lib/librte_compressdev/rte_comp.c | 10 +++++-----
>> 1 file 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]);
>> --
>> 2.7.4
> Acked-by: Shally Verma <Shally.Verma@caviumnetworks.com>
>
Applied to dpdk-next-crypto
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-02 11:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-27 0:17 [dpdk-stable] [PATCH] lib/compressdev: Fix logic error on op allocation Fiona Trahe
2018-10-27 0:31 ` Thomas Monjalon
2018-10-27 0:43 ` [dpdk-stable] [PATCH v2] " Fiona Trahe
2018-10-30 14:00 ` Verma, Shally
2018-11-02 11:42 ` [dpdk-stable] [dpdk-dev] " Akhil Goyal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).