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.ereminsoleni...@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

Reply via email to