From 58607c2e27b391b2a382a8316cb490ad78118153 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 25 Jun 2020 13:32:07 -0700 Subject: [PATCH] rib: check for negative maximum of nodes Max_nodes in config is signed, but a negative value makes no sense. Get rid of extra BSD style parens. Signed-off-by: Stephen Hemminger Acked-by: Vladimir Medvedkin --- lib/librte_rib/rte_rib.c | 3 +-- lib/librte_rib/rte_rib6.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/librte_rib/rte_rib.c b/lib/librte_rib/rte_rib.c index e40cf715c0..2a370d7f84 100644 --- a/lib/librte_rib/rte_rib.c +++ b/lib/librte_rib/rte_rib.c @@ -401,8 +401,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf) struct rte_mempool *node_pool; /* Check user arguments. */ - if ((name == NULL) || (conf == NULL) || - (conf->max_nodes == 0)) { + if (name == NULL || conf == NULL || conf->max_nodes <= 0) { rte_errno = EINVAL; return NULL; } diff --git a/lib/librte_rib/rte_rib6.c b/lib/librte_rib/rte_rib6.c index 02563b9516..f6c55ee454 100644 --- a/lib/librte_rib/rte_rib6.c +++ b/lib/librte_rib/rte_rib6.c @@ -460,8 +460,7 @@ rte_rib6_create(const char *name, int socket_id, struct rte_mempool *node_pool; /* Check user arguments. */ - if ((name == NULL) || (conf == NULL) || - (conf->max_nodes == 0)) { + if (name == NULL || conf == NULL || conf->max_nodes <= 0) { rte_errno = EINVAL; return NULL; } -- 2.20.1