From: Stephen Hemminger <stephen@networkplumber.org>
To: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH 2/3] rib: check for invalid max_nodes
Date: Thu, 25 Jun 2020 13:32:07 -0700 [thread overview]
Message-ID: <20200625203208.19315-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20200625203208.19315-1-stephen@networkplumber.org>
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>
---
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
next prev parent reply other threads:[~2020-06-25 20:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 20:32 [dpdk-dev] [PATCH 0/3] rib: minor fixes Stephen Hemminger
2020-06-25 20:32 ` [dpdk-dev] [PATCH 1/3] rib: constify arguments Stephen Hemminger
2020-06-26 14:03 ` Medvedkin, Vladimir
2020-06-25 20:32 ` Stephen Hemminger [this message]
2020-06-26 14:03 ` [dpdk-dev] [PATCH 2/3] rib: check for invalid max_nodes Medvedkin, Vladimir
2020-06-25 20:32 ` [dpdk-dev] [PATCH 3/3] rib: add C++ include guard Stephen Hemminger
2020-06-26 14:04 ` Medvedkin, Vladimir
2020-07-07 21:25 ` [dpdk-dev] [PATCH 0/3] rib: minor fixes Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200625203208.19315-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=vladimir.medvedkin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).