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 26797A0471 for ; Wed, 17 Jul 2019 17:32:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F30801BE50; Wed, 17 Jul 2019 17:32:32 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id CE7011BE09; Wed, 17 Jul 2019 17:32:27 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 08:32:26 -0700 X-IronPort-AV: E=Sophos;i="5.64,274,1559545200"; d="scan'208";a="251521530" Received: from dhunt5-mobl4.ger.corp.intel.com (HELO [10.237.221.141]) ([10.237.221.141]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 17 Jul 2019 08:32:23 -0700 To: Harman Kalra , "thomas@monjalon.net" , "ferruh.yigit@linux.intel.com" Cc: "dev@dpdk.org" , Jerin Jacob Kollanukkaran , "stable@dpdk.org" References: <223181000.veHZD1QNU4@xps> <1562321046-25195-1-git-send-email-hkalra@marvell.com> <1562321046-25195-2-git-send-email-hkalra@marvell.com> From: "Hunt, David" Message-ID: <2fbf5b1d-bcd5-bb8d-4e75-2c220376633b@intel.com> Date: Wed, 17 Jul 2019 16:32:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <1562321046-25195-2-git-send-email-hkalra@marvell.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-stable] [PATCH v3 2/2] distributor: fix additional check on no of workers X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi Harman, On 05/07/2019 11:05, Harman Kalra wrote: > No of workers should never exceed RTE_MAX_LCORE. > RTE_DIST_ALG_SINGLE also require no of workers check. > > Fixes: 775003ad2f96 ("distributor: add new burst-capable library") > Cc: stable@dpdk.org > > Signed-off-by: Harman Kalra > --- > lib/librte_distributor/rte_distributor.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c > index 208abfb1d..bfcc536fd 100644 > --- a/lib/librte_distributor/rte_distributor.c > +++ b/lib/librte_distributor/rte_distributor.c > @@ -595,6 +595,12 @@ rte_distributor_create_v1705(const char *name, > RTE_BUILD_BUG_ON((sizeof(*d) & RTE_CACHE_LINE_MASK) != 0); > RTE_BUILD_BUG_ON((RTE_DISTRIB_MAX_WORKERS & 7) != 0); > > + if (name == NULL || num_workers >= > + (unsigned int)RTE_MIN(RTE_DISTRIB_MAX_WORKERS, RTE_MAX_LCORE)) { > + rte_errno = EINVAL; > + return NULL; > + } > + > if (alg_type == RTE_DIST_ALG_SINGLE) { > d = malloc(sizeof(struct rte_distributor)); > if (d == NULL) { > @@ -612,11 +618,6 @@ rte_distributor_create_v1705(const char *name, > return d; > } > > - if (name == NULL || num_workers >= RTE_DISTRIB_MAX_WORKERS) { > - rte_errno = EINVAL; > - return NULL; > - } > - > snprintf(mz_name, sizeof(mz_name), RTE_DISTRIB_PREFIX"%s", name); > mz = rte_memzone_reserve(mz_name, sizeof(*d), socket_id, NO_FLAGS); > if (mz == NULL) { Builds OK, runs OK. Change makes sense, also good to move the check to the new location. Acked-by: David Hunt