[2/3] rib: check for invalid max_nodes
Checks
Commit Message
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(-)
Comments
On 25/06/2020 21:32, Stephen Hemminger wrote:
> 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;
> }
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
@@ -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;
}
@@ -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;
}