Re: [lng-odp] [PATCH v2] linux-generic: pool: don't allocate buffers from invalid pool

2017-03-10 Thread Bill Fischofer
On Fri, Mar 10, 2017 at 11:14 AM, Dmitry Eremin-Solenikov <
dmitry.ereminsoleni...@linaro.org> wrote:

> Add ODP_ASSERT checking that passed pool is not ODP_POOL_INVALID before
> tring to allocate buffers from that pool.
>
> Signed-off-by: Dmitry Eremin-Solenikov 
>

Reviewed-by: Bill Fischofer 


> ---
>  platform/linux-generic/odp_pool.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/platform/linux-generic/odp_pool.c
> b/platform/linux-generic/odp_pool.c
> index cf7c2c41..2c1ba914 100644
> --- a/platform/linux-generic/odp_pool.c
> +++ b/platform/linux-generic/odp_pool.c
> @@ -768,6 +768,8 @@ odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
> pool_t *pool;
> int ret;
>
> +   ODP_ASSERT(ODP_POOL_INVALID != pool_hdl);
> +
> pool = pool_entry_from_hdl(pool_hdl);
> ret = buffer_alloc_multi(pool, , NULL, 1);
>
> @@ -781,6 +783,8 @@ int odp_buffer_alloc_multi(odp_pool_t pool_hdl,
> odp_buffer_t buf[], int num)
>  {
> pool_t *pool;
>
> +   ODP_ASSERT(ODP_POOL_INVALID != pool_hdl);
> +
> pool = pool_entry_from_hdl(pool_hdl);
>
> return buffer_alloc_multi(pool, buf, NULL, num);
> --
> 2.11.0
>
>


[lng-odp] [PATCH v2] linux-generic: pool: don't allocate buffers from invalid pool

2017-03-10 Thread Dmitry Eremin-Solenikov
Add ODP_ASSERT checking that passed pool is not ODP_POOL_INVALID before
tring to allocate buffers from that pool.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 platform/linux-generic/odp_pool.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/platform/linux-generic/odp_pool.c 
b/platform/linux-generic/odp_pool.c
index cf7c2c41..2c1ba914 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -768,6 +768,8 @@ odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
pool_t *pool;
int ret;
 
+   ODP_ASSERT(ODP_POOL_INVALID != pool_hdl);
+
pool = pool_entry_from_hdl(pool_hdl);
ret = buffer_alloc_multi(pool, , NULL, 1);
 
@@ -781,6 +783,8 @@ int odp_buffer_alloc_multi(odp_pool_t pool_hdl, 
odp_buffer_t buf[], int num)
 {
pool_t *pool;
 
+   ODP_ASSERT(ODP_POOL_INVALID != pool_hdl);
+
pool = pool_entry_from_hdl(pool_hdl);
 
return buffer_alloc_multi(pool, buf, NULL, num);
-- 
2.11.0