On Thu, Mar 9, 2017 at 1:21 PM Maxim Uvarov <maxim.uva...@linaro.org> wrote:

> On 03/09/2017 03:01 PM, Dmitry Eremin-Solenikov wrote:
> > Check that passed pool is not ODP_POOL_INVALID before goint to try to
> > allocate buffers from that pool.
> >
> > Signed-off-by: Dmitry Eremin-Solenikov <
> dmitry.ereminsoleni...@linaro.org>
> > ---
> >   platform/linux-generic/odp_pool.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/platform/linux-generic/odp_pool.c
> b/platform/linux-generic/odp_pool.c
> > index cf7c2c41..f0b64932 100644
> > --- a/platform/linux-generic/odp_pool.c
> > +++ b/platform/linux-generic/odp_pool.c
> > @@ -768,6 +768,9 @@ odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
> >       pool_t *pool;
> >       int ret;
> >
> > +     if (ODP_POOL_INVALID == pool_hdl)
> > +             return ODP_BUFFER_INVALID;
> > +
> That is fast path function. Or is has to be under ifdef ODP_DEBUG or not
> completely be here. Right behavior is
> segfault on bad input.
>
> Maxim.



The correct test is to use ODP_ASSERT as that only expands for debug builds.


> >       pool = pool_entry_from_hdl(pool_hdl);
> >       ret = buffer_alloc_multi(pool, &buf, NULL, 1);
> >
>
>
>

Reply via email to