From bd583923b29e5dddc4d1b9c6d0e0a513edb69496 Mon Sep 17 00:00:00 2001 From: Matias Elo Date: Fri, 5 May 2017 15:49:56 +0300 Subject: helper: tables: avoid invalid odp_shm_addr() calls odp_shm_lookup() return value can be used to detect name conflicts. Signed-off-by: Matias Elo Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- helper/hashtable.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'helper/hashtable.c') diff --git a/helper/hashtable.c b/helper/hashtable.c index 9d4114445..f26b18b27 100644 --- a/helper/hashtable.c +++ b/helper/hashtable.c @@ -76,8 +76,7 @@ odph_table_t odph_hash_table_create(const char *name, uint32_t capacity, ODPH_DBG("create para input error!\n"); return NULL; } - tbl = (odph_hash_table_imp *)odp_shm_addr(odp_shm_lookup(name)); - if (tbl != NULL) { + if (odp_shm_lookup(name) != ODP_SHM_INVALID) { ODPH_DBG("name already exist\n"); return NULL; } -- cgit v1.2.3