Message ID | 20170310101455.32505-1-dmitry.ereminsolenikov@linaro.org |
---|---|
State | New |
Headers | show |
On Fri, Mar 10, 2017 at 11:14 AM, Dmitry Eremin-Solenikov < dmitry.ereminsolenikov@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 <dmitry.ereminsolenikov@linaro.org> > Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > 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, &buf, 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 > >
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, &buf, 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);
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 <dmitry.ereminsolenikov@linaro.org> --- platform/linux-generic/odp_pool.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.11.0