[dpdk-dev] [PATCH] lib/lpm: fix return value of rte_lpm_create

Anatoly Burakov anatoly.burakov at intel.com
Wed Jan 31 13:40:59 CET 2018


LPM library is supposed to return NULL pointer on an attempt
to call rte_lpm_create with an existing name.

Fixes: 134975073af3 ("lib: remove unnecessary pointer cast")
Cc: zhiyong.yang at intel.com

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 lib/librte_lpm/rte_lpm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index d464dbd..efbbbca 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -254,6 +254,7 @@ rte_lpm_create_v1604(const char *name, int socket_id,
 		if (strncmp(name, lpm->name, RTE_LPM_NAMESIZE) == 0)
 			break;
 	}
+	lpm = NULL;
 
 	if (te != NULL) {
 		rte_errno = EEXIST;
-- 
2.7.4


More information about the dev mailing list