From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33417A051C; Fri, 26 Jun 2020 16:03:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 066DF1BFCA; Fri, 26 Jun 2020 16:03:49 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 270711BFA6 for ; Fri, 26 Jun 2020 16:03:46 +0200 (CEST) IronPort-SDR: h0OJHSR273+G0HbOb3CPVEa7qBa/xEidp82NzadCOdzrSpbDFpihFc4dqP6KAWQNS8AY8i3Hca Ama4K2A8fgDA== X-IronPort-AV: E=McAfee;i="6000,8403,9663"; a="163376194" X-IronPort-AV: E=Sophos;i="5.75,283,1589266800"; d="scan'208,217";a="163376194" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2020 07:03:45 -0700 IronPort-SDR: l7fYGdzVf5339G/91QxQBuBmkVAN6tvum7hp7FKcf0yAPvAD0dQnlYOAQ1wsJSoKlx/8Bvc2iW UI7Ewt6tHOsA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,283,1589266800"; d="scan'208,217";a="276374321" Received: from vmedvedk-mobl.ger.corp.intel.com (HELO [10.251.170.129]) ([10.251.170.129]) by orsmga003.jf.intel.com with ESMTP; 26 Jun 2020 07:03:44 -0700 To: Stephen Hemminger Cc: dev@dpdk.org References: <20200625203208.19315-1-stephen@networkplumber.org> <20200625203208.19315-3-stephen@networkplumber.org> From: "Medvedkin, Vladimir" Message-ID: <957cdb61-8bdd-f100-b575-cd9cc126eddd@intel.com> Date: Fri, 26 Jun 2020 15:03:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200625203208.19315-3-stephen@networkplumber.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 2/3] rib: check for invalid max_nodes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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 -- Regards, Vladimir