]> git.droids-corp.org - dpdk.git/commitdiff
rib: check for negative maximum of nodes
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 25 Jun 2020 20:32:07 +0000 (13:32 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 7 Jul 2020 21:22:18 +0000 (23:22 +0200)
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@networkplumber.org>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
lib/librte_rib/rte_rib.c
lib/librte_rib/rte_rib6.c

index e40cf715c099ed91ad2d5e47ec0b35ea92100cea..2a370d7f84398940f38fd65b8528b48328493d4c 100644 (file)
@@ -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;
        }
index 02563b951620a225c4d583d76e1537aa1ea64f7f..f6c55ee454bed75977c969aa6a751b16e6a286d1 100644 (file)
@@ -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;
        }