[dpdk-dev] [PATCH 2/3] rib: check for invalid max_nodes
Stephen Hemminger
stephen at networkplumber.org
Thu Jun 25 22:32:07 CEST 2020
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 <stephen at networkplumber.org>
---
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 e40cf715c099..2a370d7f8439 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 02563b951620..f6c55ee454be 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.26.2
More information about the dev
mailing list